← Back to PRs

#18805: fix(web-search): skip invalid bare ui_lang codes in Brave Search requests

by andrey-esipov open 2026-02-17 02:55 View on GitHub →
agents size: XS
## Summary Brave Search API requires full locale codes (e.g. `en-US`), not bare language codes (e.g. `en`). When the model generates a bare code, the API returns a 422 validation error, breaking web search entirely for all Brave users. Fixes #18795 ## Changes `src/agents/tools/web-search.ts`: Add a hyphen check on `ui_lang` before passing it to the Brave API. Bare language codes are silently skipped, letting the API fall back to its default (`en-US`). ## Test plan - [x] `oxfmt --check` passes - [x] `oxlint` passes (0 warnings, 0 errors) - [x] Manual: send a web search query via Brave — should no longer 422

Most Similar PRs