Debug web_fetch/web_search tool argument parsing in 0xKobold
Session from 0xKobolds on Hugging Face by moikapy · MIT · condensed by Coders Talk
Click a segment to jump to that moment
25msession
2interventions
GOAL
The developer wanted help identifying and fixing why the web_fetch and web_search tools in their 0xKobold agent framework were failing with 'Invalid URL' errors even when passing valid https:// URLs.
- +0Prompt · +0Clarify what project/directory we're actually in (0xKobolds vs resume-optimizer)
- +0mAgent did · +0mExplored directory structure and package.json to determine actual project location, eventually identifying resume-optimizer as a Next.js app living inside 0xKobolds
- +10mIntervention · +10mDeveloper says they deleted the resume-optimizer copy inside 0xKobolds since it wasn't supposed to be there, redirecting to the sibling directoryWhy: the agent got confused about nested vs sibling directories so I had to correct where the real project lived
- +12mPrompt · +12mIn plan mode, what's the best model to use for a resume optimizer?
- +12mAgent did · +12mRecommended Claude 3.5 Sonnet as primary model with GPT-4o and budget alternatives, then attempted to use web_fetch/web_search tools to verify against OpenRouter's live model list
- +13mFail · +13mweb_fetch and web_search tools both failed with 'Invalid URL. Must start with http:// or https://' errors despite valid URLs being passed
- +19mIntervention · +19mDeveloper points out the URL clearly did start with https:// so the tool itself must be broken, pushing the agent to actually investigate instead of working around itWhy: I noticed the URL was valid so the tool code had to be buggy, not my input, and told it to look into the tool itself
- +22mPrompt · +22mEnter plan mode and create a team of sub agents to investigate the tool failure
- +23mAgent did · +23mTraced the bug through websearch-extension.ts, mode-manager-extension.ts, and pi-adapter.ts, concluding the framework likely nests tool arguments differently than the code expects (e.g. args.parameters.url vs args.url)
- +24mAgent did · +24mEdited websearch-extension.ts to defensively extract url/query/question from multiple possible argument shapes for web_fetch, web_search, and web_qa, then wrote and ran a test script confirming argument extraction now works
- +25mOutcome · +25mRoot cause found and fixed: web_fetch, web_search, and web_qa now defensively extract arguments from multiple possible shapes; test script confirms valid URL extraction succeeds
VERDICT
Next time I'd tell it up front which exact directory the project lives in, since half this session was spent untangling a confused nested-vs-sibling directory mixup before we even got to real work. The fix that actually mattered was when I pushed back on the tool's own error message instead of accepting the agent's excuse that my URL was wrong - that's what got it to dig into the actual argument-passing bug in the framework.