iflytek/astron-agent · error · Exception
get variable error
Error message
get variable error: {e} What it means
get_variable wraps all internal resolution failures (nested key errors, schema problems, etc.) in a single generic Exception 'get variable error: {e}'. It is a catch-all re-raise, so the original error's type and code (e.g. VARIABLE_POOL_GET_PARAMETER_ERROR) are lost — only its message survives in the text.
Solutions
- Read the wrapped message after 'get variable error:' to identify the root cause (usually a missing-key schema error)
- Fix the referenced key path against the producing node's output schema
- Refactor to re-raise the original exception (or chain with `raise ... from e`) to preserve error codes
- Pre-validate the key path against the schema before calling get_variable
Example fix
// before
except Exception as e:
raise Exception(f"get variable error: {e}")
// after
except CustomException:
raise
except Exception as e:
raise Exception(f"get variable error: {e}") from e Defensive patterns
Strategy: try-catch
Validate before calling
if assemble_mapping_key(node_id, key_name) not in pool.output_variable_mapping:
raise KeyError(f"{node_id} does not declare output {key_name}") Type guard
def variable_available(pool, node_id: str, key_name: str) -> bool:
try:
pool.get_variable(node_id, key_name, span, first_only=False)
return True
except Exception:
return False Try / catch
try:
val = pool.get_variable(node_id, key_name, span)
except Exception as e:
log.error(f"variable fetch failed for {node_id}.{key_name}: {e}")
val = default Prevention
- Parse the wrapped message after 'get variable error:' to find the root cause
- Validate key paths against the schema before calling get_variable
- Prefer get_output_variable with its coded CustomException when you need error codes
When it happens
Trigger: Any exception raised while resolving (node_id, key_name) inside get_variable's try block — most commonly missing keys in the output schema, malformed nested paths, or schema type errors — when called via get_variable_first, async_execute, _get_actual_parameter, etc.
Common situations: Debugging why a node failed at runtime: the log shows only 'get variable error: ...' with a nested message; key path typos in node configs; upstream schema changes breaking downstream references.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
- VARIABLE_POOL_SET_PARAMETER_ERROR
- VARIABLE_POOL_GET_PARAMETER_ERROR
- VARIABLE_POOL_SET_PARAMETER_ERROR
- ENG_PROTOCOL_VALIDATE_ERROR
- Failed to convert literal value
AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12).
Data as JSON: /api/errors/85068dc97649814d.
Report an issue: GitHub.
Appendix: source
Thrown at core/workflow/engine/entities/variable_pool.py:764
node_value = (
ref_content.name if isinstance(ref_content, NodeRef) else ""
)
return self.get_output_variable(
node_id=node_id,
key_name=node_value,
span=span,
first_only=first_only,
)
if mapping_key in self.output_variable_mapping:
# Support nested access like input.iii.yyy
return self.get_output_variable(
node_id=node_id,
key_name=key_name,
span=span,
first_only=first_only,
)
except Exception as e:
raise Exception(f"get variable error: {e}")
def get_variable_first(self, node_id: str, key_name: str, span: Span) -> Any:
"""
Get variable value, extracting only the first element for array object.
:param node_id: ID of the node
:param key_name: Name of the variable
:param span: Span object for tracing
:return: Variable value (first element for arrays object)
"""
return self.get_variable(node_id, key_name, span, first_only=True)
def add_end_node_variable(
self, node_id: str, key_name_list: list[str], value: NodeRunResult
) -> None:
"""
Add variables for end node.
View on GitHub (pinned to 5e758547a8)