{"record":{"id":"624dd5d8a7d2acd5","repo":"stanford-oval/storm","slug":"unexpected-output-action","errorCode":null,"errorMessage":"unexpected output: {action}","messagePattern":"unexpected output: (.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"knowledge_storm/collaborative_storm/modules/costorm_expert_utterance_generator.py","lineNumber":140,"sourceCode":"                    lm=self.action_planning_lm, show_guidelines=False\n                ):\n                    action = self.expert_action(\n                        topic=topic,\n                        expert=current_expert,\n                        summary=conversation_summary,\n                        last_utterance=last_utterance,\n                    ).resposne\n                action_type, action_content = self.parse_action(action)\n\n        if self.callback_handler is not None:\n            self.callback_handler.on_expert_action_planning_end()\n        # get response\n        conversation_turn = ConversationTurn(\n            role=current_expert, raw_utterance=\"\", utterance_type=action_type\n        )\n\n        if action_type == \"Undefined\":\n            raise Exception(f\"unexpected output: {action}\")\n        elif action_type in [\"Further Details\", \"Potential Answer\"]:\n            with self.logging_wrapper.log_event(\n                \"RoundTableConversationModule: QuestionAnswering\"\n            ):\n                grounded_answer = self.answer_question_module(\n                    topic=topic,\n                    question=action_content,\n                    mode=\"brief\",\n                    style=\"conversational and concise\",\n                    callback_handler=self.callback_handler,\n                )\n            conversation_turn.claim_to_make = action_content\n            conversation_turn.raw_utterance = grounded_answer.response\n            conversation_turn.queries = grounded_answer.queries\n            conversation_turn.raw_retrieved_info = grounded_answer.raw_retrieved_info\n            conversation_turn.cited_info = grounded_answer.cited_info\n        elif action_type in [\"Original Question\", \"Information Request\"]:\n            conversation_turn.raw_utterance = action_content","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/stanford-oval/storm/blob/fb951af7744dab086e34962e9bc6fe878e145f83/knowledge_storm/collaborative_storm/modules/costorm_expert_utterance_generator.py#L122-L158","documentation":"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.","triggerScenarios":"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'.","commonSituations":"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.","solutions":["Inspect what the LM actually returned for the action classification and fix the LM configuration/model quality","Wrap forward in a retry loop (optionally with a temperature bump) since 'Undefined' is a parse failure","Upgrade/switch to a stronger instruction-following model"],"exampleFix":"# before\nout = module(topic=topic, conv_history=history, current_expert=expert)\n\n# after\nfor attempt in range(3):\n    out = module(topic=topic, conv_history=history, current_expert=expert)\n    if out.utterance_type != 'Undefined':\n        break\n# else: fall back to a default 'Further Details' turn","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"for _ in range(3):\n    try:\n        turn = module(...)\n        if turn.utterance_type != 'Undefined':\n            break\n    except Exception as e:\n        if 'unexpected output' not in str(e):\n            raise\nelse:\n    turn = default_turn()","preventionTips":["Use a strong instruction-following LM","Validate LM label output before dispatch","Retry transient parse failures once or twice"],"tags":["co-storm","dspy","llm-output-parsing"],"backgroundTag":"llm-output-unparseable","analyzedSha":"fb951af7744dab086e34962e9bc6fe878e145f83","analyzedAt":"2026-08-28T11:56:54.780Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}