{"record":{"id":"64be16bffabfc6df","repo":"invoke-ai/InvokeAI","slug":"node-batch-data-node-path-not-found-in-graph","errorCode":null,"errorMessage":"Node {batch_data.node_path} not found in graph","messagePattern":"Node (.+?) not found in graph","errorType":"validation","errorClass":"NodeNotFoundError","httpStatus":null,"severity":"error","filePath":"invokeai/app/services/session_queue/session_queue_common.py","lineNumber":148,"sourceCode":"        paths: set[tuple[str, str]] = set()\n        for batch_data_list in v:\n            for datum in batch_data_list:\n                pair = (datum.node_path, datum.field_name)\n                if pair in paths:\n                    raise BatchDuplicateNodeFieldError(\"Each batch data must have unique node_id and field_name\")\n                paths.add(pair)\n        return v\n\n    @model_validator(mode=\"after\")\n    def validate_batch_nodes_and_edges(self):\n        if self.data is None:\n            return self\n        for batch_data_list in self.data:\n            for batch_data in batch_data_list:\n                try:\n                    node = self.graph.get_node(batch_data.node_path)\n                except NodeNotFoundError:\n                    raise NodeNotFoundError(f\"Node {batch_data.node_path} not found in graph\")\n                if batch_data.field_name not in type(node).model_fields:\n                    raise NodeNotFoundError(f\"Field {batch_data.field_name} not found in node {batch_data.node_path}\")\n        return self\n\n    @field_validator(\"graph\")\n    def validate_graph(cls, v: Graph):\n        v.validate_self()\n        return v\n\n    model_config = ConfigDict(\n        json_schema_extra={\n            \"required\": [\n                \"graph\",\n                \"runs\",\n            ]\n        }\n    )\n","sourceCodeStart":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/app/services/session_queue/session_queue_common.py#L130-L166","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Update batch data node_path values to match the current graph's node ids (visible in the workflow editor)","Re-create the batch data against the current workflow instead of reusing old config","Verify the correct graph is attached to the Batch (graph and data must come from the same workflow)","Validate with graph.get_node(node_path) client-side before enqueuing"],"exampleFix":"// before: stale node id\n{\"node_path\": \"abc123-old\", \"field_name\": \"prompt\"}\n// after: id from current graph\n{\"node_path\": \"abc123-new\", \"field_name\": \"prompt\"}","handlingStrategy":"validation","validationCode":"def validate_batch_nodes(batch, graph):\n    for batch_data_list in batch.data or []:\n        for d in batch_data_list:\n            try:\n                graph.get_node(d.node_path)\n            except NodeNotFoundError:\n                raise ValueError(f\"Batch references missing node {d.node_path}; rebuild bindings for the current graph.\")","typeGuard":"def all_nodes_exist(batch, graph) -> bool:\n    return all(\n        d.node_path in graph.nodes\n        for lst in (batch.data or [])\n        for d in lst\n    )","tryCatchPattern":"try:\n    session_queue.enqueue_queue_item(batch_session)\nexcept NodeNotFoundError as e:\n    logger.error(f\"Stale batch binding: {e}\")\n    # re-bind batch data to current graph node ids","preventionTips":["Regenerate batch data whenever the workflow's node ids change","Don't reuse batch data across different or re-imported workflows","Record node ids alongside batch config and diff before enqueue","Validate node existence client-side before calling the API"],"tags":["batch","graph","validation"],"backgroundTag":"batch-node-not-in-graph","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}