# Scattering doesn't work

**URL:** <https://cwl.discourse.group/t/scattering-doesnt-work/994>\
**Category:** CWL Questions\
**Created:** [March 24, 2025, 10:46pm UTC](https://cwl.discourse.group/t/scattering-doesnt-work/994 "2025-03-24T22:46:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![skgo](https://avatars.discourse-cdn.com/v4/letter/s/7cd45c/32.png) [@skgo](https://cwl.discourse.group/u/skgo)\
**Post date:** [March 24, 2025, 10:46pm UTC](https://cwl.discourse.group/t/scattering-doesnt-work/994/1 "2025-03-24T22:46:16Z")

</div>

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

```auto
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:

```auto
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.

---

<div class="post-metadata">

**Author:** ![mrc](https://yyz2.discourse-cdn.com/free1/user_avatar/cwl.discourse.group/mrc/32/3_2.png) [@mrc](https://cwl.discourse.group/u/mrc)\
**Post date:** [March 25, 2025, 8:06am UTC](https://cwl.discourse.group/t/scattering-doesnt-work/994/2 "2025-03-25T08:06:26Z")

</div>

```auto
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]

```

`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](https://github.com/common-workflow-language/cwltool/issues/2112) to track that
