Scattering doesn't work

When I try to run a small test pipeline using scattering I get the following error:

INFO /usr/bin/cwltool 3.1.20250110105449
INFO Resolved 'scatter.cwl' to 'file:///home/ubuntu/scatter.cwl'
ERROR I'm sorry, I couldn't load this CWL file.
The error was: 
Traceback (most recent call last):
  File "/home/ubuntu/.local/lib/python3.12/site-packages/cwltool/main.py", line 1132, in main
    tool = make_tool(uri, loadingContext)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/.local/lib/python3.12/site-packages/cwltool/load_tool.py", line 588, in make_tool
    tool = loadingContext.construct_tool_object(processobj, loadingContext)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/.local/lib/python3.12/site-packages/cwltool/workflow.py", line 44, in default_make_tool
    return Workflow(toolpath_object, loadingContext)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/.local/lib/python3.12/site-packages/cwltool/workflow.py", line 97, in __init__
    self.make_workflow_step(step, index, loadingContext, loadingContext.prov_obj)
  File "/home/ubuntu/.local/lib/python3.12/site-packages/cwltool/workflow.py", line 142, in make_workflow_step
    return WorkflowStep(toolpath_object, pos, loadingContext, parentworkflowProv)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/.local/lib/python3.12/site-packages/cwltool/workflow.py", line 376, in __init__
    inp_map[inp]["type"] = {"type": "array", "items": inp_map[inp]["type"]}
                                                      ~~~~~~~^^^^^
KeyError: 'file:///home/ubuntu/scatter.cwl#bamFile'

My CWL file looks like:

cwlVersion: v1.2
class: Workflow

requirements:
  InlineJavascriptRequirement: {}
  StepInputExpressionRequirement: {}
  SubworkflowFeatureRequirement: {}
  ScatterFeatureRequirement: {}

inputs:
  sampleID:
    type: string[]
  bamFile:
    type: File[]
  read_structure:
    type: string[]
  molecular_index_tags:
    type: string[]
  single_tag:
    type: string

outputs:
  umi_bam:
    type: File[]
    outputSource: extract_umis/output_bam

steps:
  extract_umis:
    run: cwl-demo/tools/fgbio/fgbio_ExtractUmisFromBam.cwl
    scatter:
      - sampleID
      - bamFile
    scatterMethod: dotproduct
    in: 
      sampleID: sampleID
      input: bamFile
      read_structure: read_structure
      molecular_index_tags: molecular_index_tags
      single_tag: single_tag
    out: [output_bam]

I don’t understand why it doesn’t like bamFile. If I make bamFile into a File instead of a File[], change sampleID into a string, and remove the scattering it works fine.

steps:
  extract_umis:
    run: cwl-demo/tools/fgbio/fgbio_ExtractUmisFromBam.cwl
    scatter:
      - sampleID
      - input
    scatterMethod: dotproduct
    in: 
      sampleID: sampleID
      input: bamFile
      read_structure: read_structure
      molecular_index_tags: molecular_index_tags
      single_tag: single_tag
    out: [output_bam]

[/quote]

scatter refers to the step input names in in, not where their source(s) are from. So change bamFile to input and that should work.

The error message is not good, I’ve opened https://github.com/common-workflow-language/cwltool/issues/2112 to track that