Skip to content

misleading error message when string is passed where File is expected #1199

@pvanheus

Description

@pvanheus

Expected Behavior

When a string type parameter is passed and a File or Directory is expected, cwltool should tell the user that the input parameter is the wrong type.

Actual Behavior

cwltool shows the error message (for input named input1):

the `input1` field is not valid because
                 is not a dict

Workflow Code

#!/usr/bin/env cwl-runner

cwlVersion: v1.0
class: CommandLineTool

inputs:
  input1:
      type: File
      inputBinding:
        position: 1

baseCommand: cat 

stdout: output.txt
outputs:
  output:
    type: stdout

or with Directory

#!/usr/bin/env cwl-runner

cwlVersion: v1.0
class: CommandLineTool

inputs:
  input1:
      type: Directory
      inputBinding:
        position: 1

baseCommand: ls

stdout: output.txt
outputs:
  output:
    type: stdout

and input YML:

input1: test1.cwl

Full Traceback

Traceback (most recent call last):
  File "/home/pvh/anaconda3/envs/cwltool/lib/python3.7/site-packages/cwltool/main.py", line 834, in main
    logger=_logger)
  File "/home/pvh/anaconda3/envs/cwltool/lib/python3.7/site-packages/cwltool/executors.py", line 46, in __call__
    return self.execute(*args, **kwargs)
  File "/home/pvh/anaconda3/envs/cwltool/lib/python3.7/site-packages/cwltool/executors.py", line 106, in execute
    self.run_jobs(process, job_order_object, logger, runtime_context)
  File "/home/pvh/anaconda3/envs/cwltool/lib/python3.7/site-packages/cwltool/executors.py", line 169, in run_jobs
    for job in jobiter:
  File "/home/pvh/anaconda3/envs/cwltool/lib/python3.7/site-packages/cwltool/command_line_tool.py", line 430, in job
    builder = self._init_job(job_order, runtimeContext)
  File "/home/pvh/anaconda3/envs/cwltool/lib/python3.7/site-packages/cwltool/process.py", line 657, in _init_job
    raise_from(WorkflowException("Invalid job input record:\n" + Text(err)), err)
  File "/home/pvh/anaconda3/envs/cwltool/lib/python3.7/site-packages/future/utils/__init__.py", line 400, in raise_from
    exec(execstr, myglobals, mylocals)
  File "<string>", line 1, in <module>
cwltool.errors.WorkflowException: Invalid job input record:
test1.yml:1:1: the `input1` field is not valid because
test1.yml:1:1:   is not a dict

Your Environment

  • cwltool version: 1.0.20190915164430

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