iflytek/astron-agent · error · CustomException

CodeEnum.VARIABLE_NODE_EXECUTION_ERROR

CodeEnum.VARIABLE_NODE_EXECUTION_ERROR

Error message

Variable aggregation fallback value type is invalid for {schema_type}

What it means

_parse_fallback_value converts and type-checks a variable aggregation fallback value against the declared output schema type (string/number/array/object...). If the converted value fails the type validator for schema_type, it raises CustomException with CodeEnum.VARIABLE_NODE_EXECUTION_ERROR.

Solutions

  1. Set the fallback value to match the declared schema type (list for 'array', dict for 'object', etc.)
  2. Update the node's output schema to the type the fallback actually is
  3. Check the value conversion step upstream — ensure coercion produced the expected type
  4. Validate node configuration in the workflow editor before running

Example fix

# before
fallback_value = "[]"  # schema_type: array
# after
fallback_value = []    # schema_type: array
Defensive patterns

Strategy: type-guard

Validate before calling

validators = {"string": str, "number": (int, float), "array": list, "object": dict}
assert isinstance(fallback_value, validators[schema_type]), f"fallback must be {schema_type}"

Type guard

def fallback_matches_schema(value, schema_type: str) -> bool:
    checks = {"string": lambda v: isinstance(v, str), "number": lambda v: isinstance(v, (int, float)) and not isinstance(v, bool), "array": lambda v: isinstance(v, list), "object": lambda v: isinstance(v, dict)}
    return checks.get(schema_type, lambda v: True)(value)

Try / catch

try:
    result = node.async_execute(...)
except CustomException as e:
    if e.err_code == CodeEnum.VARIABLE_NODE_EXECUTION_ERROR:
        logger.error(f"bad fallback config: {e.err_msg}")
        raise

Prevention

When it happens

Trigger: Configuring a fallback default value in a variable aggregation node whose runtime type does not match the output schema, e.g. schema_type='array' but the fallback is a string, or 'object' with a non-dict value.

Common situations: Misconfigured node form where the default value field holds the wrong JSON type; schema changed but the fallback default was not updated; values coming from strings in config that were never converted.

Understand the failure class

Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.

Related errors


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

Appendix: source

Thrown at core/workflow/engine/nodes/variable_aggregation/variable_aggregation_node.py:119

        schema_type = schema.get("type")
        if not schema_type:
            return value

        converted_value = VariableAggregationNode._convert_to_type(value, schema_type)

        # Validate the type after conversion
        type_validators = {
            "string": lambda x: isinstance(x, str),
            "boolean": lambda x: isinstance(x, bool),
            "integer": lambda x: isinstance(x, int) and not isinstance(x, bool),
            "number": lambda x: isinstance(x, (int, float)) and not isinstance(x, bool),
            "array": lambda x: isinstance(x, list),
            "object": lambda x: isinstance(x, dict),
        }

        validator = type_validators.get(schema_type)
        if validator and not validator(converted_value):
            raise CustomException(
                CodeEnum.VARIABLE_NODE_EXECUTION_ERROR,
                err_msg=f"Variable aggregation fallback value type is invalid for {schema_type}",
            )

        return converted_value

    async def async_execute(
        self,
        variable_pool: VariablePool,
        span: Span,
        event_log_node_trace: NodeLog | None = None,
        **kwargs: Any,
    ) -> NodeRunResult:
        try:
            if not self.output_identifier:
                raise CustomException(
                    CodeEnum.ENG_NODE_PROTOCOL_VALIDATE_ERROR,
                    err_msg="Variable aggregation node requires one output",

View on GitHub (pinned to 5e758547a8)