invoke-ai/InvokeAI · error · RequiredConnectionException

RequiredConnectionException

Error message

RequiredConnectionException

What it means

RequiredConnectionException is raised during node validation in invoke_internal when an input field declared with Input.Connection is None at execution time. It means the node has a required field that can only be filled by an edge coming from another node, and no such connection (or no output from the connected node) supplied a value. The linear graph executor refuses to run the node rather than pass None downstream.

Source

Thrown at invokeai/app/invocations/baseinvocation.py:234

        Internal invoke method, calls `invoke()` after some prep.
        Handles optional fields that are required to call `invoke()` and invocation cache.
        """
        for field_name, field in type(self).model_fields.items():
            if not field.json_schema_extra or callable(field.json_schema_extra):
                # something has gone terribly awry, we should always have this and it should be a dict
                continue

            # Here we handle the case where the field is optional in the pydantic class, but required
            # in the `invoke()` method.

            orig_default = field.json_schema_extra.get("orig_default", PydanticUndefined)
            orig_required = field.json_schema_extra.get("orig_required", True)
            input_ = field.json_schema_extra.get("input", None)
            if orig_default is not PydanticUndefined and not hasattr(self, field_name):
                setattr(self, field_name, orig_default)
            if orig_required and orig_default is PydanticUndefined and getattr(self, field_name) is None:
                if input_ == Input.Connection:
                    raise RequiredConnectionException(type(self).model_fields["type"].default, field_name)
                elif input_ == Input.Any:
                    raise MissingInputException(type(self).model_fields["type"].default, field_name)

        # skip node cache codepath if it's disabled
        if services.configuration.node_cache_size == 0:
            return self.invoke(context)

        output: BaseInvocationOutput
        if self.use_cache:
            key = services.invocation_cache.create_key(self)
            cached_value = services.invocation_cache.get(key)
            if cached_value is None:
                services.logger.debug(f'Invocation cache miss for type "{self.get_type()}": {self.id}')
                output = self.invoke(context)
                services.invocation_cache.save(key, output)
                return output
            else:
                services.logger.debug(f'Invocation cache hit for type "{self.get_type()}": {self.id}')

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Add the missing edge in the graph so the required field receives output from an upstream node before invoking.
  2. Verify the upstream node actually executes and produces output (check upstream node failures first).
  3. If the field should not be required, change it to have a default value or declare input=Input.Any/Input.Direct with a default.
  4. In tests, construct the invocation with all connection inputs populated instead of relying on defaults.

Example fix

// before
image = ImageField(image_name="")  # never connected

// after
graph.add_edge(
  source=EdgeConnection(node_id="load_image", field="image"),
  destination=EdgeConnection(node_id="my_node", field="image"),
)
Defensive patterns

Strategy: validation

Validate before calling

# before invoking, verify every Input.Connection field on each node has an incoming edge
connected = {(e.destination.node_id, e.destination.field) for e in graph.edges.values()}
for node in graph.nodes.values():
    for name, field in type(node).model_fields.items():
        extra = field.json_schema_extra or {}
        if extra.get("input") == Input.Connection and extra.get("orig_required", True):
            if getattr(node, name, None) is None and (node.id, name) not in connected:
                raise ValueError(f"node {node.id}: missing connection for '{name}'")

Try / catch

try:
    result = run_node(node, context)
except RequiredConnectionException as e:
    logger.error("node %s missing connection on field %s", e.node_id, e.field_name)

Prevention

When it happens

Trigger: Executing a graph where a node's Input.Connection field (e.g. an image or latents input) has no incoming edge, or the edge source node failed/was skipped so the value is None. Also triggered when running a node directly (e.g. via run_node) without wiring required inputs.

Common situations: Graphs edited in the workflow editor with a deleted edge; programmatic graph construction missing edges; a batch or iteration expander removing the intended edge; calling run_node in tests on a node whose required connection was never set.

Related errors


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