langchain-ai/langgraph · error · ValueError

Node ` ` already present.

Error message

Node `{node}` already present.

What it means

Raised by StateGraph.add_node when the node name already exists in the graph. Duplicate node names would make routing ambiguous, so re-adding a node with an identical name is rejected. Choose a unique name or remove the existing node first.

Solutions

  1. Choose a different, unique node name
  2. Remove or rename the previously added node before re-adding
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at libs/langgraph/langgraph/graph/state.py:803 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of langchain-ai/langgraph@38031739e5 (2026-08-26). Data as JSON: /api/errors/efaedf631d735f17. Report an issue: GitHub.

Appendix: source

Thrown at libs/langgraph/langgraph/graph/state.py:803

                raise ValueError(
                    "Node name must be provided if action is not a function"
                )
        if self.compiled:
            logger.warning(
                "Adding a node to a graph that has already been compiled. This will "
                "not be reflected in the compiled graph."
            )
        if not isinstance(node, str):
            action = node
            node = cast(str, getattr(action, "name", getattr(action, "__name__", None)))
            if node is None:
                raise ValueError(
                    "Node name must be provided if action is not a function"
                )
        if action is None:
            raise RuntimeError
        if node in self.nodes:
            raise ValueError(f"Node `{node}` already present.")
        if node == END or node == START:
            raise ValueError(f"Node `{node}` is reserved.")

        for character in (NS_SEP, NS_END):
            if character in node:
                raise ValueError(
                    f"'{character}' is a reserved character and is not allowed in the node names."
                )

        inferred_input_schema = None

        ends: tuple[str, ...] | dict[str, str] = EMPTY_SEQ
        try:
            if (
                isfunction(action)
                or ismethod(action)
                or ismethod(getattr(action, "__call__", None))
            ) and (

View on GitHub (pinned to 38031739e5)