{"record":{"id":"ad4a2289f6b8cfb1","repo":"iflytek/astron-agent","slug":"eng-run-error","errorCode":"ENG_RUN_ERROR","errorMessage":"Branch node did not return result","messagePattern":"Branch node did not return result","errorType":"error_code","errorClass":"CustomException","httpStatus":null,"severity":"error","filePath":"core/workflow/engine/dsl_engine.py","lineNumber":1049,"sourceCode":"        next_active_nodes, next_inactive_nodes = [], []\n        node_type = node.id.split(\":\")[0]\n\n        # Check if this is a branch type node\n        branch_type = self._is_branch_node(node_type, node)\n\n        if fail_branch:\n            # Failure branch scenario\n            next_active_nodes = node.get_fail_nodes()\n            next_inactive_nodes = [\n                item\n                for item in node.get_next_nodes()\n                if item not in node.get_fail_nodes()\n            ]\n        else:\n            if branch_type:\n                # Branch nodes need to select branch based on result\n                if not run_result:\n                    raise CustomException(\n                        CodeEnum.ENG_RUN_ERROR,\n                        err_msg=\"Branch node did not return result\",\n                    )\n                next_active_nodes = await self._handle_branch_node_logic(\n                    node, run_result, node_type\n                )\n                next_inactive_nodes = [\n                    n for n in node.next_nodes if n not in next_active_nodes\n                ]\n            else:\n                # Regular node\n                next_active_nodes = node.get_next_nodes()\n\n            # Add failure branches to inactive nodes\n            next_inactive_nodes.extend(\n                [\n                    item\n                    for item in node.get_fail_nodes()","sourceCodeStart":1031,"sourceCodeEnd":1067,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/core/workflow/engine/dsl_engine.py#L1031-L1067","documentation":"When advancing the workflow after a branch-type node, the engine requires a run_result to select the next branch. If the node returned nothing (None) the engine raises ENG_RUN_ERROR 'Branch node did not return result' rather than silently choosing a path.","triggerScenarios":"_get_next_nodes invoked via _execute_single_node for a branch-type node whose execution produced an empty/None run_result — e.g. the node executor returned None instead of a NodeRunResult, or streaming produced no final result.","commonSituations":"Custom/overridden node strategy returning None on some code path; a branch (if-else / question-classification) node whose execute silently swallows an error and returns nothing; engine/plugin version mismatch where node handlers changed signatures.","solutions":["Inspect why the branch node's strategy returned None — fix the node handler to always return a NodeRunResult","Check fail-branch/streaming handling so non-success results still produce a run_result","Upgrade or align node plugin implementations with the engine version","Add explicit error returns in custom node code instead of bare returns"],"exampleFix":"// before\ndef execute(...):\n    if not ok:\n        return  # None\n// after\ndef execute(...):\n    if not ok:\n        return NodeRunResult(status=FAILED, error=\"branch failed\")","handlingStrategy":"type-guard","validationCode":"if node.type in BRANCH_TYPES and node.strategy is CUSTOM:\n    assert callable(getattr(node.handler, \"execute\", None))","typeGuard":"def has_run_result(r) -> bool:\n    return r is not None and getattr(r, \"status\", None) is not None","tryCatchPattern":"try:\n    next_nodes = await engine._get_next_nodes(node, run_result, node_type)\nexcept CustomException as e:\n    logger.error(\"branch advance failed: %s\", e.err_msg)\n    run_fail_branch(node_id)","preventionTips":["Custom node handlers must always return a NodeRunResult, never None","Cover streaming completion paths with tests that assert a final result","Pin plugin node implementations to compatible engine versions"],"tags":["workflow","branch-node","engine"],"backgroundTag":"empty-result-set","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"}