invoke-ai/InvokeAI · error · NodeNotFoundError

Node {batch_data.node_path} not found in graph

Error message

Node {batch_data.node_path} not found in graph

What it means

Batch data references nodes by node_path (node id); validate_batch_nodes_and_edges resolves each reference against the batch's graph. If graph.get_node cannot find the node, NodeNotFoundError('Node <id> not found in graph') is raised so misconfigurations are caught before execution.

Source

Thrown at invokeai/app/services/session_queue/session_queue_common.py:148

        paths: set[tuple[str, str]] = set()
        for batch_data_list in v:
            for datum in batch_data_list:
                pair = (datum.node_path, datum.field_name)
                if pair in paths:
                    raise BatchDuplicateNodeFieldError("Each batch data must have unique node_id and field_name")
                paths.add(pair)
        return v

    @model_validator(mode="after")
    def validate_batch_nodes_and_edges(self):
        if self.data is None:
            return self
        for batch_data_list in self.data:
            for batch_data in batch_data_list:
                try:
                    node = self.graph.get_node(batch_data.node_path)
                except NodeNotFoundError:
                    raise NodeNotFoundError(f"Node {batch_data.node_path} not found in graph")
                if batch_data.field_name not in type(node).model_fields:
                    raise NodeNotFoundError(f"Field {batch_data.field_name} not found in node {batch_data.node_path}")
        return self

    @field_validator("graph")
    def validate_graph(cls, v: Graph):
        v.validate_self()
        return v

    model_config = ConfigDict(
        json_schema_extra={
            "required": [
                "graph",
                "runs",
            ]
        }
    )

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Update batch data node_path values to match the current graph's node ids (visible in the workflow editor)
  2. Re-create the batch data against the current workflow instead of reusing old config
  3. Verify the correct graph is attached to the Batch (graph and data must come from the same workflow)
  4. Validate with graph.get_node(node_path) client-side before enqueuing

Example fix

// before: stale node id
{"node_path": "abc123-old", "field_name": "prompt"}
// after: id from current graph
{"node_path": "abc123-new", "field_name": "prompt"}
Defensive patterns

Strategy: validation

Validate before calling

def validate_batch_nodes(batch, graph):
    for batch_data_list in batch.data or []:
        for d in batch_data_list:
            try:
                graph.get_node(d.node_path)
            except NodeNotFoundError:
                raise ValueError(f"Batch references missing node {d.node_path}; rebuild bindings for the current graph.")

Type guard

def all_nodes_exist(batch, graph) -> bool:
    return all(
        d.node_path in graph.nodes
        for lst in (batch.data or [])
        for d in lst
    )

Try / catch

try:
    session_queue.enqueue_queue_item(batch_session)
except NodeNotFoundError as e:
    logger.error(f"Stale batch binding: {e}")
    # re-bind batch data to current graph node ids

Prevention

When it happens

Trigger: A batch datum's node_path names a node id that does not exist in the graph supplied with the batch — e.g. the graph was regenerated with new ids, the node was deleted, or the batch data came from a different workflow.

Common situations: Reusing saved batch data with an edited/re-imported workflow whose node ids changed; typo in the node id; loading batch + graph from mismatched sources.

Related errors


AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29). Data as JSON: /api/errors/64be16bffabfc6df. Report an issue: GitHub.