{"record":{"id":"2f7e11926f9e6122","repo":"microsoft/autogen","slug":"start-node-node-name-must-be-added-before-sett","errorCode":null,"errorMessage":"Start node '{node_name}' must be added before setting as entry point.","messagePattern":"Start node '(.+?)' must be added before setting as entry point\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/packages/autogen-agentchat/src/autogen_agentchat/teams/_group_chat/_graph/_graph_builder.py","lineNumber":194,"sourceCode":"            Self for method chaining\n        \"\"\"\n\n        warnings.warn(\n            \"add_conditional_edges will be changed in the future to support callable conditions. \"\n            \"For now, please use add_edge if you need to specify custom conditions.\",\n            DeprecationWarning,\n            stacklevel=2,\n        )\n\n        for condition_keyword, target in condition_to_target.items():\n            self.add_edge(source, target, condition=condition_keyword)\n        return self\n\n    def set_entry_point(self, name: Union[str, ChatAgent]) -> \"DiGraphBuilder\":\n        \"\"\"Set the default start node of the graph.\"\"\"\n        node_name = self._get_name(name)\n        if node_name not in self.nodes:\n            raise ValueError(f\"Start node '{node_name}' must be added before setting as entry point.\")\n        self._default_start_node = node_name\n        return self\n\n    def build(self) -> DiGraph:\n        \"\"\"Build and validate the DiGraph.\"\"\"\n        graph = DiGraph(\n            nodes=self.nodes,\n            default_start_node=self._default_start_node,\n        )\n        graph.graph_validate()\n        return graph\n\n    def get_participants(self) -> list[ChatAgent]:\n        \"\"\"Return the list of agents in the builder, in insertion order.\"\"\"\n        return list(self.agents.values())\n","sourceCodeStart":176,"sourceCodeEnd":210,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/python/packages/autogen-agentchat/src/autogen_agentchat/teams/_group_chat/_graph/_graph_builder.py#L176-L210","documentation":"DiGraphBuilder.set_entry_point() raises ValueError when the named node has not yet been added to the builder via add_node(). The builder validates that the entry point references an existing node before assigning it as the graph's default start node. This prevents building a DiGraph whose default_start_node points to a nonexistent node.","triggerScenarios":"Calling DiGraphBuilder().set_entry_point(\"agent1\") (or passing a ChatAgent instance whose name was never added) before calling add_node() for that name; also renaming an agent after set_entry_point or using a name with a typo.","commonSituations":"Building a GraphFlow/DiGraph topology where the developer wires the entry point first and adds nodes afterwards; using an AssistantAgent's name string that differs from the name used in add_agent(); copy-paste node names between examples.","solutions":["Call builder.add_node(agent) (or add_node(name=...)) for the entry node before set_entry_point(...).","If passing a ChatAgent to set_entry_point, pass the exact same agent object (or its .name) that was registered with add_node.","Assert membership first: if name not in builder.nodes: builder.add_node(...) before setting the entry point."],"exampleFix":"# before\nbuilder = DiGraphBuilder()\nbuilder.set_entry_point(\"researcher\")  # ValueError: not added yet\nbuilder.add_node(researcher_agent)\n\n# after\nbuilder = DiGraphBuilder()\nbuilder.add_node(researcher_agent)\nbuilder.set_entry_point(researcher_agent)  # or \"researcher\" if that is its name","handlingStrategy":"validation","validationCode":"name = agent.name\nif name not in builder.nodes:\n    builder.add_node(agent)\nbuilder.set_entry_point(name)","typeGuard":"def is_registered_node(builder: DiGraphBuilder, name: str) -> bool:\n    return name in builder.nodes","tryCatchPattern":"try:\n    builder.set_entry_point(name)\nexcept ValueError as e:\n    raise ValueError(f\"Entry point '{name}' not added. Known nodes: {list(builder.nodes)}\") from e","preventionTips":["Always add nodes before wiring edges or entry points in DiGraphBuilder.","Pass the agent object to set_entry_point to avoid name typos.","Assert the entry point is in builder.nodes right before build()."],"tags":["autogen","graph","validation","entry-point"],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}