{"record":{"id":"f07ceabf204f031a","repo":"iflytek/astron-agent","slug":"codeenum-variable-node-execution-error","errorCode":"CodeEnum.VARIABLE_NODE_EXECUTION_ERROR","errorMessage":"Variable aggregation fallback value type is invalid for {schema_type}","messagePattern":"Variable aggregation fallback value type is invalid for (.+?)","errorType":"error_code","errorClass":"CustomException","httpStatus":null,"severity":"error","filePath":"core/workflow/engine/nodes/variable_aggregation/variable_aggregation_node.py","lineNumber":119,"sourceCode":"        schema_type = schema.get(\"type\")\n        if not schema_type:\n            return value\n\n        converted_value = VariableAggregationNode._convert_to_type(value, schema_type)\n\n        # Validate the type after conversion\n        type_validators = {\n            \"string\": lambda x: isinstance(x, str),\n            \"boolean\": lambda x: isinstance(x, bool),\n            \"integer\": lambda x: isinstance(x, int) and not isinstance(x, bool),\n            \"number\": lambda x: isinstance(x, (int, float)) and not isinstance(x, bool),\n            \"array\": lambda x: isinstance(x, list),\n            \"object\": lambda x: isinstance(x, dict),\n        }\n\n        validator = type_validators.get(schema_type)\n        if validator and not validator(converted_value):\n            raise CustomException(\n                CodeEnum.VARIABLE_NODE_EXECUTION_ERROR,\n                err_msg=f\"Variable aggregation fallback value type is invalid for {schema_type}\",\n            )\n\n        return converted_value\n\n    async def async_execute(\n        self,\n        variable_pool: VariablePool,\n        span: Span,\n        event_log_node_trace: NodeLog | None = None,\n        **kwargs: Any,\n    ) -> NodeRunResult:\n        try:\n            if not self.output_identifier:\n                raise CustomException(\n                    CodeEnum.ENG_NODE_PROTOCOL_VALIDATE_ERROR,\n                    err_msg=\"Variable aggregation node requires one output\",","sourceCodeStart":101,"sourceCodeEnd":137,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/core/workflow/engine/nodes/variable_aggregation/variable_aggregation_node.py#L101-L137","documentation":"_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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Set the fallback value to match the declared schema type (list for 'array', dict for 'object', etc.)","Update the node's output schema to the type the fallback actually is","Check the value conversion step upstream — ensure coercion produced the expected type","Validate node configuration in the workflow editor before running"],"exampleFix":"# before\nfallback_value = \"[]\"  # schema_type: array\n# after\nfallback_value = []    # schema_type: array","handlingStrategy":"type-guard","validationCode":"validators = {\"string\": str, \"number\": (int, float), \"array\": list, \"object\": dict}\nassert isinstance(fallback_value, validators[schema_type]), f\"fallback must be {schema_type}\"","typeGuard":"def fallback_matches_schema(value, schema_type: str) -> bool:\n    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)}\n    return checks.get(schema_type, lambda v: True)(value)","tryCatchPattern":"try:\n    result = node.async_execute(...)\nexcept CustomException as e:\n    if e.err_code == CodeEnum.VARIABLE_NODE_EXECUTION_ERROR:\n        logger.error(f\"bad fallback config: {e.err_msg}\")\n        raise","preventionTips":["Fill fallback defaults via typed form fields, not free text","Update fallback values whenever the output schema changes","JSON-parse string defaults into real arrays/objects at config time","Validate node config in CI or on workflow save"],"tags":["type-mismatch","variable-aggregation","schema"],"backgroundTag":"type-mismatch","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-19T12:17:13.211Z"}