stanford-oval/storm · error · Exception

Undefined predicted action in knowledge navigation. {predict

Error message

Undefined predicted action in knowledge navigation. {predicted_action}

What it means

_get_navigation_choice parses the LM's predicted navigation action and expects it to start with 'node:', 'step:', or 'create:'. Anything else (including malformed or free-text output) falls through to this exception.

Source

Thrown at knowledge_storm/collaborative_storm/modules/information_insertion_module.py:104

        with dspy.settings.context(lm=self.engine):
            predicted_action = self.insert_info(
                intent=intent, structure=structure
            ).choice

        # parse action
        cleaned_predicted_action = trim_output_after_hint(
            predicted_action, "Choice:"
        ).strip()
        cleaned_predicted_action = cleaned_predicted_action.strip("-").strip()
        if cleaned_predicted_action.startswith("insert"):
            return "insert", ""
        elif cleaned_predicted_action.startswith("step:"):
            node_name = trim_output_after_hint(cleaned_predicted_action, "step:")
            return "step", node_name
        elif cleaned_predicted_action.startswith("create:"):
            node_name = trim_output_after_hint(cleaned_predicted_action, "create:")
            return "create", node_name
        raise Exception(
            f"Undefined predicted action in knowledge navigation. {predicted_action}"
        )

    def layer_by_layer_navigation_placement(
        self,
        knowledge_base: KnowledgeBase,
        question: str,
        query: str,
        allow_create_new_node: bool = False,
        root: Optional[KnowledgeNode] = None,
    ):
        current_node: KnowledgeNode = knowledge_base.root if root is None else root

        while True:
            action_type, node_name = self._get_navigation_choice(
                knowledge_node=current_node, question=question, query=query
            )
            if action_type == "insert":

View on GitHub (pinned to fb951af774)

Solutions

  1. Use a stronger instruction-following LM for the navigation module
  2. Retry the navigation call on this exception (parse failures are often transient)
  3. Add prefix normalization/fuzzy matching before invoking the module if you control the prediction pipeline

Example fix

# before
placement = module.layer_by_layer_navigation_placement(kb, question, information)

# after
try:
    placement = module.layer_by_layer_navigation_placement(kb, question, information)
except Exception as e:
    if 'Undefined predicted action' in str(e):
        placement = module.layer_by_layer_navigation_placement(kb, question, information)  # retry
    else:
        raise
Defensive patterns

Strategy: retry

Type guard

def is_valid_action(pred: str) -> bool:
    p = pred.strip().lower()
    return p.startswith(('node:', 'step:', 'create:'))

Try / catch

try:
    placement = module.layer_by_layer_navigation_placement(kb, q, info)
except Exception as e:
    if 'Undefined predicted action' in str(e):
        placement = module.layer_by_layer_navigation_placement(kb, q, info)
    else:
        raise

Prevention

When it happens

Trigger: Calling layer_by_layer_navigation_placement with an LLM prediction whose cleaned action string lacks all three recognized prefixes, e.g. 'I would put it under History'.

Common situations: LLM answers in prose instead of the constrained format, model/prompt drift, or weak models ignoring few-shot examples.

Related errors


AI-assisted analysis of stanford-oval/storm@fb951af774 (2026-08-28). Data as JSON: /api/errors/b7b6b008993c8cd2. Report an issue: GitHub.