{"record":{"id":"f6ac6da440fe9bc9","repo":"iflytek/astron-agent","slug":"variable-pool-set-parameter-error-node-node-id-input-mapping","errorCode":"VARIABLE_POOL_SET_PARAMETER_ERROR","errorMessage":"Node {node_id} input parameter {mapping_key} does not exist","messagePattern":"Node (.+?) input parameter (.+?) does not exist","errorType":"error_code","errorClass":"CustomException","httpStatus":null,"severity":"error","filePath":"core/workflow/engine/entities/variable_pool.py","lineNumber":503,"sourceCode":"        value: dict,\n        span: Span,\n    ) -> None:\n        \"\"\"\n        Initialize variables for a node with validation.\n\n        :param node_id: ID of the node to initialize variables for\n        :param key_name_list: List of variable names to initialize\n        :param value: Dictionary containing variable values\n        :param span: Span object for tracing and error reporting\n        \"\"\"\n        self.do_validate(\n            node_id=node_id, key_name_list=key_name_list, outputs=value, span=span\n        )\n        for key in key_name_list:\n            mapping_key = assemble_mapping_key(node_id, key)\n            if mapping_key not in self.output_variable_mapping:\n                span.add_error_event(f\"input key {mapping_key} not exist\")\n                raise CustomException(\n                    err_code=CodeEnum.VARIABLE_POOL_SET_PARAMETER_ERROR,\n                    err_msg=f\"Node {node_id} input parameter {mapping_key} does not exist\",\n                )\n            mapping_value = self.output_variable_mapping[mapping_key]\n            value_schema = mapping_value.get(\"schema\")\n            input_value_content = value.get(key)\n            is_update = False\n            python_schema_type = schema_type_map_python.get(\n                value_schema.get(\"type\"), []\n            )\n            for schema_type in python_schema_type:\n                if isinstance(input_value_content, schema_type):\n                    is_update = True\n                    break\n            if is_update:\n                mapping_value.update({\"value\": input_value_content})\n\n    def get_output_schema(self, node_id: str, key_name: str) -> Dict[str, Any]:","sourceCodeStart":485,"sourceCodeEnd":521,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/core/workflow/engine/entities/variable_pool.py#L485-L521","documentation":"Raised by VariablePool.add_init_variable when seeding initial outputs for a node: the assembled mapping key (node_id + key name) is not present in output_variable_mapping, meaning the node's protocol does not declare that output parameter. Thrown as CustomException with code VARIABLE_POOL_SET_PARAMETER_ERROR after logging 'input key ... not exist' to the span.","triggerScenarios":"Calling add_init_variable(node_id, key_name_list, value, ...) with a key name that the node's declared output schema does not contain (mapping key absent from output_variable_mapping).","commonSituations":"Typo in the output parameter name; node schema changed (output renamed/removed) while init code still passes the old key; passing start/system node inputs whose keys were never registered in the pool.","solutions":["Compare key_name_list against the node's declared output schema and fix the key names","Update the node's output definition to include the missing key if it is legitimately needed","Ensure add_init_variable runs only after output_variable_mapping has been populated from the protocol","Log/inspect self.output_variable_mapping keys for that node to find the correct name"],"exampleFix":"// before\npool.add_init_variable(node_id, [\"outpu\"], result, span)\n// after\nkeys = [k for k in declared_output_keys(node_id)]\npool.add_init_variable(node_id, keys, result, span)","handlingStrategy":"validation","validationCode":"declared = {assemble_mapping_key(node_id, k) for k in node_output_keys(node_id)}\nmissing = [k for k in key_name_list if assemble_mapping_key(node_id, k) not in declared]\nassert not missing, f\"undeclared output keys: {missing}\"","typeGuard":"def key_declared(pool, node_id: str, key: str) -> bool:\n    return assemble_mapping_key(node_id, key) in pool.output_variable_mapping","tryCatchPattern":"try:\n    pool.add_init_variable(node_id, keys, value, span)\nexcept CustomException as e:\n    if e.err_code == CodeEnum.VARIABLE_POOL_SET_PARAMETER_ERROR:\n        log.error(f\"init keys invalid for {node_id}: {e.err_msg}\")\n    else:\n        raise","preventionTips":["Derive init keys from the node's schema, never hardcode them","Call add_init_variable only after the pool's output mapping is built","Log output_variable_mapping keys when initializing a new node type"],"tags":["workflow","variable-pool","schema","python"],"backgroundTag":"missing-required-argument","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"}