Skip to content

[bug]: For loop over an empty Iterate item fails with NodeInputError #9819

Closed

Description

@lstein

Is there an existing issue for this problem?

  • I have searched the existing issues

Version number

main at aa46003 (7.0.0-alpha.2-post); also on #9789

What happened

Feed each item of an Iterate into a For loop's collection. If any item is an empty list, the session fails with NodeInputError: Node … has invalid incoming input for a when the loop body runs. No If is involved.

What you expected to happen

The empty item's For should run zero iterations and give an empty output_collection. The non-empty items should run normally. Here the result should be [[11, 12], []].

How to reproduce the problem

g = Graph()
g.add_node(CollectionConcatInvocation(id="source", first=[[1, 2], []]))
g.add_node(IterateInvocation(id="iterate"))
g.add_node(ForInvocation(id="for"))
g.add_node(AddInvocation(id="body", b=10))
g.add_node(ForReturnInvocation(id="return"))
g.add_node(CollectInvocation(id="collect"))
g.add_edge(create_edge("source", "collection", "iterate", "collection"))
g.add_edge(create_edge("iterate", "item", "for", "collection"))
g.add_edge(create_edge("for", "item", "body", "a"))
g.add_edge(create_edge("body", "value", "return", "output"))
g.add_edge(create_loop_linkage("for", "return"))
g.add_edge(create_edge("for", "output_collection", "collect", "item"))

Additional context

The trace is source, iterate, iterate, for, body. A body execution is created for the empty item's For (index -1) without its a input.

Found while reviewing #9789.

Activity

  1. JPPhoto commented on Oct 18, 2026

    @JPPhoto
    Collaborator

    Resolved in PR #9843. Empty inner collections now produce empty For results without scheduling a body invocation. Regression coverage checks an Iterate feeding [ [1, 2], [] ] into For and completion on both scheduler paths.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions