stanford-oval/storm · error · ValueError

Unknown action type: {action_type}

Error message

Unknown action type: {action_type}

What it means

layer_by_layer_navigation_placement only understands 'node', 'step', and 'create' action types; any other string reaches the else branch and raises ValueError('Unknown action type').

Source

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

            elif action_type == "step":
                for child in current_node.children:
                    if child.name == node_name:
                        current_node = child
                        break
                else:
                    raise ValueError(f"Child node with name {node_name} not found.")
            elif action_type == "create":
                placement_path = current_node.get_path_from_root(root)
                if allow_create_new_node:
                    placement_path.append(node_name)
                    note = f"create new node: {{{node_name}}} under {{{current_node.name}}}"
                else:
                    note = f"attempt to create new node: {{{node_name}}} under {{{current_node.name}}}"
                return dspy.Prediction(
                    information_placement=" -> ".join(placement_path), note=note
                )
            else:
                raise ValueError(f"Unknown action type: {action_type}")

    def _get_sorted_embed_sim_section(
        self,
        encoded_outline: np.ndarray,
        outlines: List[str],
        question: str,
        query: str,
    ):
        if encoded_outline is not None and encoded_outline.size > 0:
            encoded_query = self.encoder.encode(f"{question}, {query}")
            sim = cosine_similarity([encoded_query], encoded_outline)[0]
            sorted_indices = np.argsort(sim)
            sorted_outlines = np.array(outlines)[sorted_indices[::-1]]
            return sorted_outlines
        else:
            return outlines

    def _parse_selected_index(self, string: str):

View on GitHub (pinned to fb951af774)

Solutions

  1. Restrict action types to 'node', 'step', 'create' before calling
  2. If you need custom actions, subclass/patch layer_by_layer_navigation_placement to handle them

Example fix

# before
module.layer_by_layer_navigation_placement(kb, q, info, actions=[('insert', 'History')])

# after
module.layer_by_layer_navigation_placement(kb, q, info, actions=[('create', 'History')])
Defensive patterns

Strategy: validation

Validate before calling

VALID = {'node', 'step', 'create'}
actions = [(a, n) for a, n in actions if a in VALID]

Type guard

def is_known_action(action_type: str) -> bool:
    return action_type in {'node', 'step', 'create'}

Try / catch

try:
    module.layer_by_layer_navigation_placement(kb, q, info, actions=acts)
except ValueError as e:
    if 'Unknown action type' not in str(e):
        raise
    acts = [(a if a in VALID else 'create', n) for a, n in acts]

Prevention

When it happens

Trigger: Directly calling layer_by_layer_navigation_placement with a custom (action_type, node_name) tuple whose action_type isn't one of the three supported values, or upstream parsing changes introducing new labels.

Common situations: User code constructs navigation intents manually or monkey-patches/extends action labels without updating the dispatcher.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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