invoke-ai/InvokeAI · error · InvalidEdgeError
Invalid collector node ({node.id}): {err}
Error message
Invalid collector node ({node.id}): {err} What it means
InvalidEdgeError raised in validate_self() for each CollectInvocation whose connections fail _is_collector_connection_valid(). A collector aggregates 'item'-typed edges into a collection, so all incoming edges must have the same type; the checker's err string is embedded in the message.
Source
Thrown at invokeai/app/services/shared/graph.py:1860
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`
"""
self._validate_unique_node_ids()
self._validate_node_id_mapping()
self._validate_edge_nodes_and_fields()View on GitHub (pinned to 0b6a024f2f)
Solutions
- Make every edge into the collector's 'item' field carry the same type
- Split heterogeneous outputs into separate collectors
- Add conversion nodes so all inputs share one type
- Remove stale edges after refactoring the graph
Example fix
// before g.add_edge(image_node, "image", collector, "item") g.add_edge(prompt_node, "prompt", collector, "item") # mixed types // after g.add_edge(img_a, "image", collector, "item") g.add_edge(img_b, "image", collector, "item")
Defensive patterns
Strategy: validation
Validate before calling
def collector_inputs_ok(graph, collect_node_id):
return graph._is_collector_connection_valid(collect_node_id) is None
for node_id in g.nodes:
if isinstance(g.get_node(node_id), CollectInvocation):
assert collector_inputs_ok(g, node_id), node_id Type guard
def is_valid_collector(graph, node) -> bool:
if not isinstance(node, CollectInvocation):
return False
return graph._is_collector_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 collector node" in str(e):
fix_collector_connections(e)
raise Prevention
- Feed a collector only edges of one identical item type
- Split heterogeneous outputs into separate collectors
- Validate graphs containing iterate/collect pairs as a unit
When it happens
Trigger: validate_self() encountering a CollectInvocation with incoming item edges of differing/incompatible types, or malformed connections to its 'item'/'collection' fields (via _is_collector_connection_valid).
Common situations: Collecting outputs of heterogeneous nodes (image + string) into one collector, iterating a collection and feeding differently-typed branches into the same collector, hand-edited workflow JSON.
Related errors
- Invalid iterator node ({node.id}): {err}
- The selected saved workflow must contain exactly one workflo
- Graph contains cycles
- Edge source and target types do not match ({edge})
- Problem validating graph {e}
AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29).
Data as JSON: /api/errors/92f81ed9793b2408.
Report an issue: GitHub.