invoke-ai/InvokeAI · error · NodeFieldNotFoundError

Edge source field {edge.source.field} does not exist in node

Error message

Edge source field {edge.source.field} does not exist in node {edge.source.node_id}

What it means

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.

Source

Thrown at invokeai/app/services/shared/graph.py:1817

            raise DuplicateNodeIdError(f"Node ids must be unique, found duplicates {duplicate_node_ids}")

    def _validate_node_id_mapping(self) -> None:
        for node_dict_id, node in self.nodes.items():
            if node_dict_id != node.id:
                raise NodeIdMismatchError(f"Node ids must match, got {node_dict_id} and {node.id}")

    def _validate_edge_nodes_and_fields(self) -> None:
        for edge in self.edges:
            source_node = self.nodes.get(edge.source.node_id, None)
            if source_node is None:
                raise NodeNotFoundError(f"Edge source node {edge.source.node_id} does not exist in the graph")

            destination_node = self.nodes.get(edge.destination.node_id, None)
            if destination_node is None:
                raise NodeNotFoundError(f"Edge destination node {edge.destination.node_id} does not exist in the graph")

            if edge.source.field not in source_node.get_output_annotation().model_fields:
                raise NodeFieldNotFoundError(
                    f"Edge source field {edge.source.field} does not exist in node {edge.source.node_id}"
                )

            if edge.destination.field not in type(destination_node).model_fields:
                if isinstance(destination_node, CallSavedWorkflowInvocation) and is_call_saved_workflow_dynamic_input(
                    edge.destination.field
                ):
                    continue
                raise NodeFieldNotFoundError(
                    f"Edge destination field {edge.destination.field} does not exist in node {edge.destination.node_id}"
                )

    def _validate_graph_is_acyclic(self) -> None:
        graph = self.nx_graph_flat()
        if not nx.is_directed_acyclic_graph(graph):
            raise CyclicalGraphError("Graph contains cycles")

    def _validate_edge_type_compatibility(self) -> None:

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Correct the edge's source.field to an actual field of the source node's output type (check its get_output_annotation().model_fields)
  2. Point the edge at the correct source node that produces the desired field
  3. Re-generate the workflow from the current UI so edge fields match current node schemas
  4. Catch NodeFieldNotFoundError during migration and remap renamed fields

Example fix

# before
EdgeConnection(node_id="image_gen", field="image_url")

# after
EdgeConnection(node_id="image_gen", field="image")  # actual output field
Defensive patterns

Strategy: validation

Validate before calling

def check_edge_source_fields(graph):
    for edge in graph.edges:
        src = graph.nodes.get(edge.source.node_id)
        if src and edge.source.field not in src.get_output_annotation().model_fields:
            raise ValueError(f"{edge.source.node_id} has no output field {edge.source.field}")
    return True

check_edge_source_fields(graph)

Type guard

def is_valid_source_field(src, field: str) -> bool:
    return field in src.get_output_annotation().model_fields

Try / catch

from invokeai.app.services.shared.graph import NodeFieldNotFoundError
try:
    graph.add_edge(edge)
    validate_graph(graph)
except NodeFieldNotFoundError as e:
    logger.error("invalid edge field: %s", e)

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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