oraios/serena · error · ValueError
Invalid topic: {topic}
Error message
Invalid topic: {topic} What it means
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.
Source
Thrown at src/serena/tools/workflow_tools.py:63
"""
return self.agent.create_system_prompt(session_id=session_id)
class SerenaInfoTool(Tool, ToolMarkerOptional, ToolMarkerDoesNotRequireActiveProject):
"""
Provides information about an advanced topic on demand, facilitating context-efficiency.
"""
def apply(self, topic: str) -> str:
"""
Retrieves Serena-specific information
:param topic: the topic, which you must have been given explicitly
"""
match topic:
case "jet_brains_debug_repl":
return self.agent.prompt_factory.create_info_jet_brains_debug_repl()
case _:
raise ValueError("Invalid topic: " + topic)
View on GitHub (pinned to 7fcbca7e62)
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
Example fix
// before info = get_info_tool.apply(topic='debugging') // after info = get_info_tool.apply(topic='jet_brains_debug_repl')
Defensive patterns
Strategy: validation
Validate before calling
VALID_TOPICS = {"jet_brains_debug_repl"}
if topic not in VALID_TOPICS:
raise ValueError(f"topic must be one of {sorted(VALID_TOPICS)}") Type guard
from typing import Literal
Topic = Literal["jet_brains_debug_repl"]
def is_valid_topic(t: str) -> bool:
return t in Topic.__args__ Try / catch
try:
info = tool.apply(topic=topic)
except ValueError:
info = None # inform the agent of valid topics Prevention
- 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
When it happens
Trigger: 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.
Common situations: Agents inventing topic strings like 'debugging' or 'config'; outdated prompts referencing topics removed in newer Serena versions.
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
- Tool named '{tool_name}' not found.
- Invalid tool name: {tool_name}{caller_context_for_logging}
- Pass either content or source_file_path
- Invalid glob brace expression in {pattern!r}: empty braces a
- Invalid glob brace expression in {pattern!r}: unmatched brac
AI-assisted analysis of oraios/serena@7fcbca7e62 (2026-08-29).
Data as JSON: /api/errors/124773c7aa3ebbe5.
Report an issue: GitHub.