Skip to content

cwltool throws validation errors despite consistent type declarations #2124

@adrabent

Description

@adrabent

Expected Behavior

cwltool --validate should not show any warnings

Actual Behavior

cwltool throws a workflow checker warning, although all types are chosen consistently. The warning output complain about "incompatibility" although both source and sink are of the same type.

Workflow Code

minimal_workflow.cwl:

class: Workflow
cwlVersion: v1.2
id: minimal_example
label: minimal_example
inputs:
  - id: msin
    type: File
outputs:
  - id: msout
    outputSource:
        - subworkflow_1/msout
        - subworkflow_2/msout
    type: File[]?
    linkMerge: merge_flattened
steps:
  - id: subworkflow_1
    in:
      - id: msin
        source: msin
    out:
      - id: msout
    run: subworkflow.cwl
  - id: subworkflow_2
    in:
      - id: msin
        source: msin
    out:
      - id: msout
    run: subworkflow.cwl
requirements:
  - class: SubworkflowFeatureRequirement

subworkflow.cwl:

class: Workflow
cwlVersion: v1.2
id: subworkflow
label: subworkflow
inputs:
  - id: msin
    type: File
outputs:
  - id: msout
    outputSource:
        - msin
    type: File[]?
    linkMerge: merge_nested
steps:
  - id: pass
    in:
      - id: msin
        source: msin
    out:
      - id: msout
    run: pass.cwl

pass.cwl ("do nothing"):

class: CommandLineTool
cwlVersion: v1.2
id: pass
baseCommand: echo
inputs:
  - id: msin
    type: File
outputs:
  - id: msout
    type: File?
    outputBinding:
      outputEval: $(inputs.msin)
requirements:
  - class: DockerRequirement
    dockerPull: ubuntu:22.04

I call the command like this:

cwltool --validate minimal_workflow.cwl

Full Traceback

INFO /usr/local/conda/envs/cwl/bin/cwltool 3.1.20250110105449
INFO Resolved 'minimal_workflow.cwl' to 'file:///home/alex/debug/minimal_workflow.cwl'
WARNING Workflow checker warning:
minimal_workflow.cwl:21:9: Source 'msout' of type ["null", {"type": "array", "items": "File"}] may
                           be incompatible
minimal_workflow.cwl:13:5:   with sink 'msout' of type ["null", {"type": "array", "items":
                             "File"}]
minimal_workflow.cwl:9:5:    source has linkMerge method merge_flattened
minimal_workflow.cwl:28:9: Source 'msout' of type ["null", {"type": "array", "items": "File"}] may
                           be incompatible
minimal_workflow.cwl:13:5:   with sink 'msout' of type ["null", {"type": "array", "items":
                             "File"}]
minimal_workflow.cwl:9:5:    source has linkMerge method merge_flattened
minimal_workflow.cwl is valid CWL.

Your Environment

  • cwltool version: 3.1.20250110105449

What works

  • Change all types to non-null types: File? --> File and File[]? --> File[]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions