You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
schema_dict_to_pydantic_model TypeError on JSON Schema type arrays → extract falls back to free-text #5904
Standard JSON Schema / OpenAPI nullable fields use "type": ["string", "null"] (and other type unions). In browser_use/tools/extraction/schema_utils.py, _resolve_type does _PRIMITIVE_MAP.get(json_type, str) when json_type is a list, which raises TypeError: unhashable type: 'list'.
extract() in browser_use/tools/service.py catches that TypeError and clears output_schema, falling back to free-text extraction. So Agent(extraction_schema=...) / extract(output_schema=...) never produce validated structured JSON for these common schemas.
The proprietary "nullable": true flag works; the standard type-array form does not.
{"type": "string", "nullable": true} → builds str | None OK
Callers that catch TypeError silently drop structured extraction
Expected
JSON Schema type arrays (especially nullable unions with "null") should build a Pydantic model, same as "nullable": true.
Suggested fix
When type is a list, map each entry through _PRIMITIVE_MAP, treat "null" as optional (T | None), and handle other unions explicitly. Do not dict.get with a list key.
Impact
Any OpenAPI-exported or JSON-Schema-draft extraction schema with nullables silently loses structured mode; agents get unconstrained free text instead of schema-validated objects.
👋 This issue has been automatically marked as stale because it hasn't had activity for 60 days.
⚡ We've made significant progress recently! Please test with the latest version of browser-use to see if this issue has been resolved. If the issue persists, please let us know by commenting below.
To keep this issue open:
Add a comment explaining why this is still relevant after testing the latest version
Add the pinned label if this is an important long-term issue
Reference it in a PR if you're working on a fix
This will be automatically closed in 14 days if no further activity occurs.
Thanks for contributing to browser-use! 🤖 If you have questions, join our Discord.
Activity
leilei3167 commentedon Sep 25, 2026
Looking into this — will open a PR for JSON Schema type array / nullable union handling in
_resolve_type.michaelkillgta commentedon Sep 25, 2026
Thanks @leilei3167 — please go ahead with the PR for type-array / nullable handling in
_resolve_type. I won’t open a competing one.github-actions commentedon Nov 25, 2026
👋 This issue has been automatically marked as stale because it hasn't had activity for 60 days.
⚡ We've made significant progress recently! Please test with the latest version of browser-use to see if this issue has been resolved. If the issue persists, please let us know by commenting below.
To keep this issue open:
pinnedlabel if this is an important long-term issueThis will be automatically closed in 14 days if no further activity occurs.
Thanks for contributing to browser-use! 🤖 If you have questions, join our Discord.