ScrapeGraphAI/Scrapegraph-ai · error · ValueError
Error parsing input keys for {self.node_name}
Error message
Error parsing input keys for {self.node_name} What it means
get_input_keys wraps _parse_input_keys and _validate_input_keys in a try/except ValueError and re-raises with the node name prefixed. So the real cause (empty input expression, expression matching no state keys, or too few input keys) is in the __cause__ exception; the message itself only tells you which node failed.
Source
Thrown at scrapegraphai/nodes/base_node.py:117
"""
Determines the necessary state keys based on the input specification.
Args:
state (dict): The current state of the graph used to parse input keys.
Returns:
List[str]: A list of input keys required for node operation.
Raises:
ValueError: If error occurs in parsing input keys.
"""
try:
input_keys = self._parse_input_keys(state, self.input)
self._validate_input_keys(input_keys)
return input_keys
except ValueError as e:
raise ValueError(f"Error parsing input keys for {self.node_name}") from e
def _validate_input_keys(self, input_keys):
"""
Validates if the provided input keys meet the minimum length requirement.
Args:
input_keys (List[str]): The list of input keys to validate.
Raises:
ValueError: If the number of input keys is less than the minimum required.
"""
if len(input_keys) < self.min_input_len:
raise ValueError(
f"""{self.node_name} requires at least {self.min_input_len} input keys,
got {len(input_keys)}."""
)
View on GitHub (pinned to 532dfffbf6)
Solutions
- Inspect the chained exception (e.__cause__) or enable debug logging to see the underlying parse error.
- Compare the node's input expression against the keys actually present in state at that step (log state.keys()).
- Fix the upstream node so it writes the expected key, or update the input expression to use the correct key name.
- Ensure graph.execute receives the required initial keys (e.g. user_prompt, url).
Example fix
# before parse_node = ParseNode(input='user_promt| doc', ...) # typo, state has user_prompt # after parse_node = ParseNode(input='user_prompt| doc', ...)
Defensive patterns
Strategy: validation
Validate before calling
def input_keys_resolvable(node, state: dict) -> bool:
try:
keys = node._parse_input_keys(state, node.input)
node._validate_input_keys(keys)
return True
except ValueError:
return False
assert input_keys_resolvable(node, expected_state), f'{node.node_name} input expression won\'t match state' Try / catch
try:
final_state, info = graph.execute(inputs)
except ValueError as e:
if 'Error parsing input keys' in str(e):
logger.error('state keys at failure: %s', set(inputs))
raise Prevention
- Align input expressions with the exact state keys produced upstream.
- Log state.keys() in custom nodes before consuming inputs.
- Unit-test nodes with realistic state dicts.
When it happens
Trigger: A node whose input expression (e.g. 'url| local_dir') contains no keys present in the current state, or a state key referenced by the expression was renamed upstream; raised during execute/_async_execute when the node asks for its inputs.
Common situations: Custom graphs where an earlier node does not emit the key a later node expects; typos in the input pipe expression; reusing a node with a state produced by a different graph; passing the wrong initial state dict to graph.execute.
Related errors
- {self.node_name} requires at least {self.min_input_len} inpu
- Empty expression.
- Error instancing model: {e}
- node_type must be 'node' or 'conditional_node', got '{node_t
- No state keys matched the expression.
AI-assisted analysis of ScrapeGraphAI/Scrapegraph-ai@532dfffbf6 (2026-08-28).
Data as JSON: /api/errors/4711ed8e396f04fa.
Report an issue: GitHub.