Skip to content

Improve error message: TypeError: '_Undefined' object does not support indexing #2699

Open
@emdupre

Description

@emdupre

Summary

In developing a nipype workflow for fMRIPrep, I hit an error that I had trouble understanding. @effigies was able to help me figure that, for my specific PR, I was failing to full disconnect a (now unused) node. But, it would be great if this error message could be improved to reference the problematic node.

Actual behavior

Traceback (most recent call last):
  File "/usr/local/miniconda/bin/fmriprep", line 11, in <module>
    sys.exit(main())
  File "/usr/local/miniconda/lib/python3.6/site-packages/fmriprep/cli/run.py", line 344, in main
    fmriprep_wf.run(**plugin_settings)
  File "/usr/local/miniconda/lib/python3.6/site-packages/nipype/pipeline/engine/workflows.py", line 585, in run
    execgraph = generate_expanded_graph(deepcopy(flatgraph))
  File "/usr/local/miniconda/lib/python3.6/site-packages/nipype/pipeline/engine/utils.py", line 932, in generate_expanded_graph
    graph_in = _remove_nonjoin_identity_nodes(graph_in, keep_iterables=True)
  File "/usr/local/miniconda/lib/python3.6/site-packages/nipype/pipeline/engine/utils.py", line 817, in _remove_nonjoin_identity_nodes
    _remove_identity_node(graph, node)
  File "/usr/local/miniconda/lib/python3.6/site-packages/nipype/pipeline/engine/utils.py", line 842, in _remove_identity_node
    portinputs)
  File "/usr/local/miniconda/lib/python3.6/site-packages/nipype/pipeline/engine/utils.py", line 919, in _propagate_internal_output
    value = evaluate_connect_function(src[1], src[2], value)
  File "/usr/local/miniconda/lib/python3.6/site-packages/nipype/pipeline/engine/utils.py", line 673, in evaluate_connect_function
    output_value = func(first_arg, *list(args))
  File "<string>", line 2, in _first
TypeError: '_Undefined' object does not support indexing

Expected behavior

...

TypeError: '_Undefined' object does not support indexing in node: bold_bold_trans_wf

How to replicate the behavior

Only partially disconnect a node in a workflow. I'm sure there are other ways to achieve this same error, but this is the one I encountered !

Script/Workflow details

Found in developing for FMRIPrep, but it should replicate in any generic workflow.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions