-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Open
Description
Bug
oh-my-opencode@3.5.0 crashes with TypeError: undefined is not an object (evaluating 'output.output.toLowerCase') when certain MCP tools (e.g., websearch_web_search_exa, context7_query-docs) return results where output.output is undefined.
Root Cause
Two unguarded .toLowerCase() calls on output.output in dist/index.js:
- Line 26788 —
tool.execute.afterhook in the main tool execution handler:
const outputLower = output.output.toLowerCase(); // crashes if output.output is undefined- Line 42754 —
createEditErrorRecoveryHook:
const outputLower = output.output.toLowerCase(); // same issueExpected Behavior
These hooks should safely handle cases where output.output is undefined or not a string (e.g., early return).
Suggested Fix
Add null/type guards before accessing output.output:
// Site 1 (main hook)
if (!output.output || typeof output.output !== "string") {
return;
}
const outputLower = output.output.toLowerCase();
// Site 2 (edit error recovery hook)
if (!output.output || typeof output.output !== "string")
return;
const outputLower = output.output.toLowerCase();Reproduction
- Install
oh-my-opencode@3.5.0with any MCP tool that returns non-string output (websearch_web_search_exa, context7, etc.) - Use the MCP tool in a session
- Observe TypeError in the console
Environment
- OpenCode: v1.1.55
- oh-my-opencode: v3.5.0
- OS: Linux
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels