invoke-ai/InvokeAI · error · InvalidEdgeError
Invalid iterator node ({node.id}): {err}
Error message
Invalid iterator node ({node.id}): {err} What it means
InvalidEdgeError raised in validate_self() for each IterateInvocation whose incoming collection connections fail _is_iterator_connection_valid(). It verifies that the types of edges feeding the iterator's 'collection' input are consistent with what the iterator will emit as 'item'. The err string from the checker is embedded in the message.
Source
Thrown at invokeai/app/services/shared/graph.py:1856
if isinstance(destination_node, CallSavedWorkflowInvocation) and is_call_saved_workflow_dynamic_input(
edge.destination.field
):
continue
if not are_connections_compatible(
self.get_node(edge.source.node_id),
edge.source.field,
destination_node,
edge.destination.field,
):
raise InvalidEdgeError(f"Edge source and target types do not match ({edge})")
def _validate_special_nodes(self) -> None:
# TODO: may need to validate all iterators & collectors in subgraphs so edge connections in parent graphs will be available
for node in self.nodes.values():
if isinstance(node, IterateInvocation):
err = self._is_iterator_connection_valid(node.id)
if err is not None:
raise InvalidEdgeError(f"Invalid iterator node ({node.id}): {err}")
if isinstance(node, CollectInvocation):
err = self._is_collector_connection_valid(node.id)
if err is not None:
raise InvalidEdgeError(f"Invalid collector node ({node.id}): {err}")
def validate_self(self) -> None:
"""
Validates the graph.
Raises an exception if the graph is invalid:
- `DuplicateNodeIdError`
- `NodeIdMismatchError`
- `InvalidSubGraphError`
- `NodeNotFoundError`
- `NodeFieldNotFoundError`
- `CyclicalGraphError`
- `InvalidEdgeError`
"""View on GitHub (pinned to 0b6a024f2f)
Solutions
- Ensure all edges into the iterator's 'collection' input come from list/array-typed outputs
- Make sure the collection element type matches what downstream consumers of the iterator's 'item' output expect
- Use a collect node to build the collection if connecting multiple edges
- Remove stale edges after changing upstream nodes
Example fix
// before g.add_edge(prompt_node, "prompt", iterator, "collection") # str, not a list // after g.add_edge(batch_prompts, "collection", iterator, "collection") # list[str]
Defensive patterns
Strategy: validation
Validate before calling
def iterator_inputs_ok(graph, iterate_node_id):
return graph._is_iterator_connection_valid(iterate_node_id) is None
for node_id in g.nodes:
if isinstance(g.get_node(node_id), IterateInvocation):
assert iterator_inputs_ok(g, node_id), node_id Type guard
def is_valid_iterator(graph, node) -> bool:
if not isinstance(node, IterateInvocation):
return False
return graph._is_iterator_connection_valid(node.id) is None Try / catch
from invokeai.app.services.shared.graph import InvalidEdgeError
try:
graph.validate_self()
except InvalidEdgeError as e:
if "Invalid iterator node" in str(e):
fix_iterator_connections(e)
raise Prevention
- Only connect list/collection-typed outputs to an iterator's collection input
- Keep iterator item consumers in sync with the collection element type
- Re-run validation after changing anything upstream of an iterator
When it happens
Trigger: validate_self() encountering an IterateInvocation node where edges into collection carry incompatible or inconsistent types with the iterator's item output (checked via _is_iterator_connection_valid with no overrides).
Common situations: Wiring a non-collection output into an iterator's collection field, mixing collection element types across edges, hand-edited workflow JSON where the iterator's upstream changed.
Related errors
- Invalid collector node ({node.id}): {err}
- Iterator input type does not match iterator output type ({ed
- The selected saved workflow must contain exactly one workflo
- Graph contains cycles
- Edge source and target types do not match ({edge})
AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29).
Data as JSON: /api/errors/e547a262d5babbd3.
Report an issue: GitHub.