iflytek/astron-agent · error · CustomException

ENG_RUN_ERROR

ENG_RUN_ERROR

Error message

Branch node did not return result

What it means

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.

Solutions

  1. Inspect why the branch node's strategy returned None — fix the node handler to always return a NodeRunResult
  2. Check fail-branch/streaming handling so non-success results still produce a run_result
  3. Upgrade or align node plugin implementations with the engine version
  4. Add explicit error returns in custom node code instead of bare returns

Example fix

// before
def execute(...):
    if not ok:
        return  # None
// after
def execute(...):
    if not ok:
        return NodeRunResult(status=FAILED, error="branch failed")
Defensive patterns

Strategy: type-guard

Validate before calling

if node.type in BRANCH_TYPES and node.strategy is CUSTOM:
    assert callable(getattr(node.handler, "execute", None))

Type guard

def has_run_result(r) -> bool:
    return r is not None and getattr(r, "status", None) is not None

Try / catch

try:
    next_nodes = await engine._get_next_nodes(node, run_result, node_type)
except CustomException as e:
    logger.error("branch advance failed: %s", e.err_msg)
    run_fail_branch(node_id)

Prevention

When it happens

Trigger: _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.

Common situations: 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.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12). Data as JSON: /api/errors/ad4a2289f6b8cfb1. Report an issue: GitHub.

Appendix: source

Thrown at core/workflow/engine/dsl_engine.py:1049

        next_active_nodes, next_inactive_nodes = [], []
        node_type = node.id.split(":")[0]

        # Check if this is a branch type node
        branch_type = self._is_branch_node(node_type, node)

        if fail_branch:
            # Failure branch scenario
            next_active_nodes = node.get_fail_nodes()
            next_inactive_nodes = [
                item
                for item in node.get_next_nodes()
                if item not in node.get_fail_nodes()
            ]
        else:
            if branch_type:
                # Branch nodes need to select branch based on result
                if not run_result:
                    raise CustomException(
                        CodeEnum.ENG_RUN_ERROR,
                        err_msg="Branch node did not return result",
                    )
                next_active_nodes = await self._handle_branch_node_logic(
                    node, run_result, node_type
                )
                next_inactive_nodes = [
                    n for n in node.next_nodes if n not in next_active_nodes
                ]
            else:
                # Regular node
                next_active_nodes = node.get_next_nodes()

            # Add failure branches to inactive nodes
            next_inactive_nodes.extend(
                [
                    item
                    for item in node.get_fail_nodes()

View on GitHub (pinned to 5e758547a8)