{"record":{"id":"cd7d64caa3d8595a","repo":"invoke-ai/InvokeAI","slug":"edge-source-field-edge-source-field-does-not-exi","errorCode":null,"errorMessage":"Edge source field {edge.source.field} does not exist in node {edge.source.node_id}","messagePattern":"Edge source field (.+?) does not exist in node (.+?)","errorType":"validation","errorClass":"NodeFieldNotFoundError","httpStatus":null,"severity":"error","filePath":"invokeai/app/services/shared/graph.py","lineNumber":1817,"sourceCode":"            raise DuplicateNodeIdError(f\"Node ids must be unique, found duplicates {duplicate_node_ids}\")\n\n    def _validate_node_id_mapping(self) -> None:\n        for node_dict_id, node in self.nodes.items():\n            if node_dict_id != node.id:\n                raise NodeIdMismatchError(f\"Node ids must match, got {node_dict_id} and {node.id}\")\n\n    def _validate_edge_nodes_and_fields(self) -> None:\n        for edge in self.edges:\n            source_node = self.nodes.get(edge.source.node_id, None)\n            if source_node is None:\n                raise NodeNotFoundError(f\"Edge source node {edge.source.node_id} does not exist in the graph\")\n\n            destination_node = self.nodes.get(edge.destination.node_id, None)\n            if destination_node is None:\n                raise NodeNotFoundError(f\"Edge destination node {edge.destination.node_id} does not exist in the graph\")\n\n            if edge.source.field not in source_node.get_output_annotation().model_fields:\n                raise NodeFieldNotFoundError(\n                    f\"Edge source field {edge.source.field} does not exist in node {edge.source.node_id}\"\n                )\n\n            if edge.destination.field not in type(destination_node).model_fields:\n                if isinstance(destination_node, CallSavedWorkflowInvocation) and is_call_saved_workflow_dynamic_input(\n                    edge.destination.field\n                ):\n                    continue\n                raise NodeFieldNotFoundError(\n                    f\"Edge destination field {edge.destination.field} does not exist in node {edge.destination.node_id}\"\n                )\n\n    def _validate_graph_is_acyclic(self) -> None:\n        graph = self.nx_graph_flat()\n        if not nx.is_directed_acyclic_graph(graph):\n            raise CyclicalGraphError(\"Graph contains cycles\")\n\n    def _validate_edge_type_compatibility(self) -> None:","sourceCodeStart":1799,"sourceCodeEnd":1835,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/app/services/shared/graph.py#L1799-L1835","documentation":"NodeFieldNotFoundError is raised when an edge's `source.field` is not present in the source node's output annotation (the Pydantic model_fields of the node's output type). Edges can only connect an output field that the source node actually produces to an input field.","triggerScenarios":"Creating an EdgeConnection whose source.field names a field absent from the source node's output model — e.g. typo, wrong node chosen as source, or the node's output schema changed between InvokeAI versions so a previously valid field no longer exists.","commonSituations":"Upgrading InvokeAI where a node's output fields were renamed/removed, breaking saved workflows; hand-editing workflow JSON; UI/API clients constructing edges from stale node schema data.","solutions":["Correct the edge's source.field to an actual field of the source node's output type (check its get_output_annotation().model_fields)","Point the edge at the correct source node that produces the desired field","Re-generate the workflow from the current UI so edge fields match current node schemas","Catch NodeFieldNotFoundError during migration and remap renamed fields"],"exampleFix":"# before\nEdgeConnection(node_id=\"image_gen\", field=\"image_url\")\n\n# after\nEdgeConnection(node_id=\"image_gen\", field=\"image\")  # actual output field","handlingStrategy":"validation","validationCode":"def check_edge_source_fields(graph):\n    for edge in graph.edges:\n        src = graph.nodes.get(edge.source.node_id)\n        if src and edge.source.field not in src.get_output_annotation().model_fields:\n            raise ValueError(f\"{edge.source.node_id} has no output field {edge.source.field}\")\n    return True\n\ncheck_edge_source_fields(graph)","typeGuard":"def is_valid_source_field(src, field: str) -> bool:\n    return field in src.get_output_annotation().model_fields","tryCatchPattern":"from invokeai.app.services.shared.graph import NodeFieldNotFoundError\ntry:\n    graph.add_edge(edge)\n    validate_graph(graph)\nexcept NodeFieldNotFoundError as e:\n    logger.error(\"invalid edge field: %s\", e)","preventionTips":["Derive edge field names from the node's output schema (get_output_annotation().model_fields), never hardcode them","After upgrading InvokeAI, re-validate saved workflows and remap renamed output fields","Fetch node schemas dynamically from the API instead of caching them long-term"],"tags":["graph","validation","invokeai","edges","fields"],"backgroundTag":"graph-edge-field-not-found","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}