When model.info.meta.capabilities is None (null), the code crashes with:
AttributeError: 'NoneType' object has no attribute 'get'
Root Cause
The dict.get(key, default) method returns the value if the key exists, even if that value is None. The default value is only used when the key is missing. So .get("capabilities", {}) returns None when the capabilities key exists but has value None, rather than returning the default {}.
Fixed get_model_capability() helper function at line 402
Changed .get("capabilities", {}) to .get("capabilities") or {} in all 3 locations
This ensures None values are treated as empty dict
Test
Manual testing confirmed:
When capabilities is None → or {} returns {} → .get() returns default value
When capabilities is {} → .get() returns default value
When capabilities has explicit values → .get() returns those values
The fix preserves default behavior (True for both builtin_tools and file_context when not specified) while preventing the AttributeError crash.
Checklist
Code follows project style
Fix is minimal and focused
No new dependencies added
All instances of the pattern in codebase are fixed
Manual testing completed
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.
## 📋 Pull Request Information
**Original PR:** https://github.com/open-webui/open-webui/pull/20743
**Author:** [@YuriNachos](https://github.com/YuriNachos)
**Created:** 1/17/2026
**Status:** ❌ Closed
**Base:** `main` ← **Head:** `fix-model-capabilities-none-check`
---
### 📝 Commits (3)
- [`f84aad5`](https://github.com/open-webui/open-webui/commit/f84aad5f141ab769d4b75628f576c89c9ff88db9) fix: handle None value for model capabilities in builtin_tools check
- [`0d4898f`](https://github.com/open-webui/open-webui/commit/0d4898fa40798e396c4deb2f9cc71b0b7d54baf4) fix: handle None value for model capabilities in file_context check
- [`9772be0`](https://github.com/open-webui/open-webui/commit/9772be02cc1d4b4153a76fd15a12d07d47f8eb66) fix: handle None value for capabilities in get_model_capability helper
### 📊 Changes
**2 files changed** (+5 additions, -7 deletions)
<details>
<summary>View changed files</summary>
📝 `backend/open_webui/utils/middleware.py` (+4 -6)
📝 `backend/open_webui/utils/tools.py` (+1 -1)
</details>
### 📄 Description
## Summary
Fixes #20565
When model.info.meta.capabilities is None (null), the code crashes with:
```
AttributeError: 'NoneType' object has no attribute 'get'
```
## Root Cause
The dict.get(key, default) method returns the value if the key exists, even if that value is None. The default value is only used when the key is missing. So `.get("capabilities", {})` returns None when the capabilities key exists but has value None, rather than returning the default {}.
## Changes
- Modified `backend/open_webui/utils/middleware.py` (2 locations)
- Fixed `builtin_tools_enabled` check at line 1813
- Fixed `file_context_enabled` check at line 1860
- Modified `backend/open_webui/utils/tools.py`
- Fixed `get_model_capability()` helper function at line 402
- Changed `.get("capabilities", {})` to `.get("capabilities") or {}` in all 3 locations
- This ensures None values are treated as empty dict
## Test
Manual testing confirmed:
- When capabilities is None → or {} returns {} → .get() returns default value
- When capabilities is {} → .get() returns default value
- When capabilities has explicit values → .get() returns those values
The fix preserves default behavior (True for both builtin_tools and file_context when not specified) while preventing the AttributeError crash.
## Checklist
- [x] Code follows project style
- [x] Fix is minimal and focused
- [x] No new dependencies added
- [x] All instances of the pattern in codebase are fixed
- [x] Manual testing completed
---
<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/20743
Author: @YuriNachos
Created: 1/17/2026
Status: ❌ Closed
Base:
main← Head:fix-model-capabilities-none-check📝 Commits (3)
f84aad5fix: handle None value for model capabilities in builtin_tools check0d4898ffix: handle None value for model capabilities in file_context check9772be0fix: handle None value for capabilities in get_model_capability helper📊 Changes
2 files changed (+5 additions, -7 deletions)
View changed files
📝
backend/open_webui/utils/middleware.py(+4 -6)📝
backend/open_webui/utils/tools.py(+1 -1)📄 Description
Summary
Fixes #20565
When model.info.meta.capabilities is None (null), the code crashes with:
Root Cause
The dict.get(key, default) method returns the value if the key exists, even if that value is None. The default value is only used when the key is missing. So
.get("capabilities", {})returns None when the capabilities key exists but has value None, rather than returning the default {}.Changes
backend/open_webui/utils/middleware.py(2 locations)builtin_tools_enabledcheck at line 1813file_context_enabledcheck at line 1860backend/open_webui/utils/tools.pyget_model_capability()helper function at line 402.get("capabilities", {})to.get("capabilities") or {}in all 3 locationsTest
Manual testing confirmed:
The fix preserves default behavior (True for both builtin_tools and file_context when not specified) while preventing the AttributeError crash.
Checklist
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.