A CWL CommandLineTool can have mandatory File inputs with a default value pointing to a local or remote file. This works as expected with cwltool. However if that CommandLineTool is in a workflow then one gets the error Anonymous file object must have 'contents' and 'basename' fields.
Stand-along example workflow-step-process-file-default.cwl:
cwlVersion: v1.2
class: Workflow
inputs: []
steps:
step_with_file_default:
run:
class: CommandLineTool
inputs:
input_with_default:
type: File
default:
class: File
path: README.rst
inputBinding: {}
baseCommand: sha256sum
outputs: []
in: {}
out: []
outputs: []
Actual:
$ cwltool workflow-step-process-file-default.cwl
INFO /home/michael/cwltool/env3.14/bin/cwltool 3.2.20260413085820.dev10+g6f0ae648e
INFO Resolved 'workflow-step-process-file-default.cwl' to 'file:///home/michael/cwltool/workflow-step-process-file-default.cwl'
INFO [workflow ] start
INFO [workflow ] starting step step_with_file_default
INFO [step step_with_file_default] start
ERROR Exception on step 'step_with_file_default'
ERROR [step step_with_file_default] Cannot make job: Invalid job input record:
Anonymous file object must have 'contents' and 'basename' fields.
INFO [workflow ] completed permanentFail
{}WARNING Final process status is permanentFail
Expected:
$ cwltool --single-process step_with_file_default workflow-step-process-file-default.cwl
INFO /home/michael/cwltool/env3.14/bin/cwltool 3.2.20260413085820.dev10+g6f0ae648e
INFO Resolved 'workflow-step-process-file-default.cwl' to 'file:///home/michael/cwltool/workflow-step-process-file-default.cwl'
INFO [job _:4c763fa5-b658-49e7-adf9-c62586a9ade3] /tmp/udx1omi0$ sha256sum \
/tmp/qk2f54hr/stgdd87cef4-ee15-48eb-b483-b0bfe20b22d8/README.rst
01ea9da4a8b50fadef9a9919b36e838843c82e3025e087f36544383fa7691b79 /tmp/qk2f54hr/stgdd87cef4-ee15-48eb-b483-b0bfe20b22d8/README.rst
INFO [job _:4c763fa5-b658-49e7-adf9-c62586a9ade3] completed success
{}INFO Final process status is success
A CWL
CommandLineToolcan have mandatoryFileinputs with adefaultvalue pointing to a local or remote file. This works as expected with cwltool. However if thatCommandLineToolis in a workflow then one gets the errorAnonymous file object must have 'contents' and 'basename' fields.Stand-along example
workflow-step-process-file-default.cwl:Actual:
Expected: