{"record":{"id":"e53ec55def7eb5c6","repo":"iflytek/astron-agent","slug":"start-node-builder-start-node-id-not-found","errorCode":null,"errorMessage":"Start node ({builder.start_node_id}) not found.","messagePattern":"Start node \\((.+?)\\) not found\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"core/workflow/engine/dsl_engine.py","lineNumber":1999,"sourceCode":"        :param span: Tracing span for observability\n        :return: BaseNode instance for debugging\n        \"\"\"\n        with span.start() as span_context:\n            builder = WorkflowEngineBuilder(sparkflow_dsl).build_nodes(span_context)\n            if len(sparkflow_dsl.nodes) == 0:\n                raise ValueError(\"WorkflowDSL must have at least one node.\")\n            builder.start_node_id = sparkflow_dsl.nodes[0].id\n            builder.chains = Chains(workflow_schema=sparkflow_dsl)\n            engine = builder.build()\n            if (\n                engine.engine_ctx\n                and builder.start_node_id in engine.engine_ctx.built_nodes\n            ):\n                return engine.engine_ctx.built_nodes[\n                    builder.start_node_id\n                ].node_instance\n            else:\n                raise ValueError(f\"Start node ({builder.start_node_id}) not found.\")\n\n\nclass WorkflowEngineBuilder:\n    \"\"\"\n    Builder for constructing workflow engines.\n\n    Implements the Builder pattern to construct workflow engines step by step,\n    including building chains, nodes, dependencies, and execution status.\n    \"\"\"\n\n    chains: Chains\n\n    def __init__(self, sparkflow_dsl: WorkflowDSL):\n        self.sparkflow_dsl: WorkflowDSL = sparkflow_dsl\n        self.built_nodes: Dict[str, SparkFlowEngineNode] = {}\n        self.start_node_id: str = \"\"\n        self.variable_pool = VariablePool(sparkflow_dsl.nodes)\n        self.iteration_engine_nodes: Dict[str, str] = {}","sourceCodeStart":1981,"sourceCodeEnd":2017,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/core/workflow/engine/dsl_engine.py#L1981-L2017","documentation":"After building nodes, create_debug_node tries to return the node instance for builder.start_node_id from engine.engine_ctx.built_nodes. If the start node (nodes[0].id) is not in built_nodes, the engine build silently skipped it and the lookup fails, raising ValueError.","triggerScenarios":"Calling create_debug_node where the first node in sparkflow_dsl.nodes was not materialized during build_nodes — e.g. its node type failed to resolve to a builder so it never entered built_nodes, while the empty-node check (1200) still passed.","commonSituations":"DSL containing only unsupported/unknown node types; nodes[0] being a special node skipped during build; partial engine builds after a silent build failure.","solutions":["Verify the first node's type is supported and gets built by build_nodes","Inspect build_nodes logs for skipped or failed node conversions","Reorder or fix the DSL so nodes[0] is a buildable node"],"exampleFix":"// before\nengine_node = dsl_engine.create_debug_node(dsl, node_id, span)\n// after\nassert dsl.nodes[0].id, \"first node has no id\"\nengine_node = dsl_engine.create_debug_node(dsl, node_id, span)","handlingStrategy":"validation","validationCode":"first = sparkflow_dsl.nodes[0]\nassert first.id, \"first node has no id\"\nnode = engine.create_debug_node(sparkflow_dsl, first.id, span)","typeGuard":"def start_node_built(dsl, builder) -> bool:\n    return bool(dsl.nodes) and dsl.nodes[0].id in builder.built_nodes","tryCatchPattern":"try:\n    node = engine.create_debug_node(dsl, node_id, span)\nexcept ValueError as e:\n    logger.error(\"start node missing after build: %s\", e)\n    raise HTTPException(422, str(e))","preventionTips":["Ensure nodes[0] is a buildable, supported node type","Log built_nodes keys after build_nodes to spot skipped nodes","Avoid relying on nodes[0] as start; validate node ordering"],"tags":["workflow","dsl","node-lookup"],"backgroundTag":"entity-not-found","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}