common-workflow-language / common-workflow-language/cwltool

Cwltool fails with type:record and no fields defined

Open
#608 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
376
Forks
255
Avg merge
2d 7h
Merged PRs (30d)
12

Description

## Expected Behavior

The cwl specification states that record types has an optional record field (http://www.commonwl.org/v1.0/CommandLineTool.html#CommandInputRecordSchema), so this file shouldn't yield an error when run:
```
cwlVersion: v1.0
class: CommandLineTool
inputs:
- id: input
type:
type: record
outputs: []
```
with an input file of:
```
input:
value: 7
```

## Actual Behavior
When running `cwltool test.cwl test.yaml` or `cwltool test.cwl`, the task fails with the error below:

Without --debug:
```
/usr/local/bin/cwltool 1.0.20180111185617
Resolved 'test.cwl' to '.../test.cwl'
I'm sorry, I couldn't load this CWL file, try again with --debug for more information.
The error was: 'fields'
```
With --debug:
```
/usr/local/bin/cwltool 1.0.20180111185617
Resolved 'test.cwl' to '.../test.cwl'
I'm sorry, I couldn't load this CWL file. The error was:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/cwltool/main.py", line 895, in main
makeTool, make_tool_kwds)
File "/usr/local/lib/python3.6/site-packages/cwltool/load_tool.py", line 322, in make_tool
tool = makeTool(processobj, **kwargs)
File "/usr/local/lib/python3.6/site-packages/cwltool/workflow.py", line 36, in defaultMakeTool
return draft2tool.CommandLineTool(toolpath_object, **kwargs)
File "/usr/local/lib/python3.6/site-packages/cwltool/draft2tool.py", line 198, in __init__
super(CommandLineTool, self).__init__(toolpath_object, **kwargs)
File "/usr/local/lib/python3.6/site-packages/cwltool/process.py", line 515, in __init__
c["type"] = avroize_type(c["type"], c["name"])
File "/usr/local/lib/python3.6/site-packages/cwltool/process.py", line 420, in avroize_type
avroize_type(field_type["fields"], name_prefix)
File "/usr/local/lib/python3.6/site-packages/ruamel/yaml/comments.py", line 680, in __getitem__
return ordereddict.__getitem__(self, key)
KeyError: 'fields'
```

## Your Environment
* cwltool version: 1.0.20180111185617

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.