#18805: fix(web-search): skip invalid bare ui_lang codes in Brave Search requests
agents
size: XS
Cluster:
Web Search Provider Enhancements
## 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
#19031: fix(web-search): normalize ui_lang parameter for Brave Search API
by moxunjinmu · 2026-02-17
75.8%
#18994: fix(web-search): normalize bare ui_lang codes to full Brave locales
by Phineas1500 · 2026-02-17
72.2%
#15512: fix(web-search): normalize Chinese language codes for Brave API
by brandonwise · 2026-02-13
63.6%
#23306: fix(web-search): hint at config validation failure in missing-key e...
by lbo728 · 2026-02-22
59.7%
#13843: feat(web-search): allow overriding Brave Search base URL
by strelov1 · 2026-02-11
58.7%
#19314: feat: add Brave web_search baseUrl override (AI-assisted)
by mrutunjay-kinagi · 2026-02-17
58.3%
#16417: feat(web-search): enable Brave text_decorations by default
by ciberponk · 2026-02-14
57.6%
#18167: feat(web-search): add baseUrl support for Brave Search provider
by jkoprax · 2026-02-16
56.6%
#19298: feat(tools): add Brave LLM Context API mode for web_search
by RoccoFortuna · 2026-02-17
55.9%
#19126: feat(web-search): add baseUrl option for Brave Search provider
by pierreeurope · 2026-02-17
55.1%