{"record":{"id":"124773c7aa3ebbe5","repo":"oraios/serena","slug":"invalid-topic-topic","errorCode":null,"errorMessage":"Invalid topic: {topic}","messagePattern":"Invalid topic: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/serena/tools/workflow_tools.py","lineNumber":63,"sourceCode":"        \"\"\"\n        return self.agent.create_system_prompt(session_id=session_id)\n\n\nclass SerenaInfoTool(Tool, ToolMarkerOptional, ToolMarkerDoesNotRequireActiveProject):\n    \"\"\"\n    Provides information about an advanced topic on demand, facilitating context-efficiency.\n    \"\"\"\n\n    def apply(self, topic: str) -> str:\n        \"\"\"\n        Retrieves Serena-specific information\n        :param topic: the topic, which you must have been given explicitly\n        \"\"\"\n        match topic:\n            case \"jet_brains_debug_repl\":\n                return self.agent.prompt_factory.create_info_jet_brains_debug_repl()\n            case _:\n                raise ValueError(\"Invalid topic: \" + topic)\n","sourceCodeStart":45,"sourceCodeEnd":64,"githubUrl":"https://github.com/oraios/serena/blob/7fcbca7e62555ec2287ddb2f083caee805848ea6/src/serena/tools/workflow_tools.py#L45-L64","documentation":"The GetInfoWorkflowTool (workflow_tools) apply method serves a fixed set of info topics via a match statement; any topic outside the enumerated cases raises ValueError 'Invalid topic: ...'. The docstring states the topic must have been given explicitly to the agent.","triggerScenarios":"Calling the get_info tool with topic values other than the supported ones (e.g. anything besides 'jet_brains_debug_repl'), often from an agent guessing a topic name.","commonSituations":"Agents inventing topic strings like 'debugging' or 'config'; outdated prompts referencing topics removed in newer Serena versions.","solutions":["Use exactly a supported topic string, e.g. topic='jet_brains_debug_repl'","Check the match statement in workflow_tools.py for the current list of valid topics","If you need info about something else, use the appropriate tool instead of get_info","Catch ValueError and surface the valid topic list to the caller"],"exampleFix":"// before\ninfo = get_info_tool.apply(topic='debugging')\n// after\ninfo = get_info_tool.apply(topic='jet_brains_debug_repl')","handlingStrategy":"validation","validationCode":"VALID_TOPICS = {\"jet_brains_debug_repl\"}\nif topic not in VALID_TOPICS:\n    raise ValueError(f\"topic must be one of {sorted(VALID_TOPICS)}\")","typeGuard":"from typing import Literal\nTopic = Literal[\"jet_brains_debug_repl\"]\ndef is_valid_topic(t: str) -> bool:\n    return t in Topic.__args__","tryCatchPattern":"try:\n    info = tool.apply(topic=topic)\nexcept ValueError:\n    info = None  # inform the agent of valid topics","preventionTips":["Only pass topics that were explicitly given in the prompt/documentation","Keep a typed Literal/enum of topics instead of free strings","Update callers when the topic list changes between versions"],"tags":["python","workflow-tools","valueerror","match-statement"],"backgroundTag":"invalid-enum-value","analyzedSha":"7fcbca7e62555ec2287ddb2f083caee805848ea6","analyzedAt":"2026-08-29T00:04:09.619Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}