stanford-oval/storm · error · Exception

unexpected output: {action}

Error message

unexpected output: {action}

What it means

The expert-utterance module classifies the next conversation action with dspy; when the classifier returns the fallback label 'Undefined' (i.e. it could not map the utterance to a known action), the forward pass raises this exception.

Source

Thrown at knowledge_storm/collaborative_storm/modules/costorm_expert_utterance_generator.py:140

                    lm=self.action_planning_lm, show_guidelines=False
                ):
                    action = self.expert_action(
                        topic=topic,
                        expert=current_expert,
                        summary=conversation_summary,
                        last_utterance=last_utterance,
                    ).resposne
                action_type, action_content = self.parse_action(action)

        if self.callback_handler is not None:
            self.callback_handler.on_expert_action_planning_end()
        # get response
        conversation_turn = ConversationTurn(
            role=current_expert, raw_utterance="", utterance_type=action_type
        )

        if action_type == "Undefined":
            raise Exception(f"unexpected output: {action}")
        elif action_type in ["Further Details", "Potential Answer"]:
            with self.logging_wrapper.log_event(
                "RoundTableConversationModule: QuestionAnswering"
            ):
                grounded_answer = self.answer_question_module(
                    topic=topic,
                    question=action_content,
                    mode="brief",
                    style="conversational and concise",
                    callback_handler=self.callback_handler,
                )
            conversation_turn.claim_to_make = action_content
            conversation_turn.raw_utterance = grounded_answer.response
            conversation_turn.queries = grounded_answer.queries
            conversation_turn.raw_retrieved_info = grounded_answer.raw_retrieved_info
            conversation_turn.cited_info = grounded_answer.cited_info
        elif action_type in ["Original Question", "Information Request"]:
            conversation_turn.raw_utterance = action_content

View on GitHub (pinned to fb951af774)

Solutions

  1. Inspect what the LM actually returned for the action classification and fix the LM configuration/model quality
  2. Wrap forward in a retry loop (optionally with a temperature bump) since 'Undefined' is a parse failure
  3. Upgrade/switch to a stronger instruction-following model

Example fix

# before
out = module(topic=topic, conv_history=history, current_expert=expert)

# after
for attempt in range(3):
    out = module(topic=topic, conv_history=history, current_expert=expert)
    if out.utterance_type != 'Undefined':
        break
# else: fall back to a default 'Further Details' turn
Defensive patterns

Strategy: retry

Try / catch

for _ in range(3):
    try:
        turn = module(...)
        if turn.utterance_type != 'Undefined':
            break
    except Exception as e:
        if 'unexpected output' not in str(e):
            raise
else:
    turn = default_turn()

Prevention

When it happens

Trigger: Calling the module's forward (indirectly via the Co-STORM conversation loop) when the underlying LM output cannot be parsed into a known action type, so action_type == 'Undefined'.

Common situations: Weak or misconfigured LM returning free text instead of labels, prompt/response format drift after model changes, or a mis-set dspy LM causing garbage outputs.

Related errors


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