[PR #23107] [CLOSED] fix: make FileModelResponse.meta optional to handle NULL database values #50080

Closed
opened 2026-04-30 02:36:39 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/23107
Author: @yang1002378395-cmyk
Created: 3/26/2026
Status: Closed

Base: devHead: fix-filemeta-required


📝 Commits (3)

  • dc22bb2 fix: preserve prefilled input value in input event dialog
  • 28926d2 fix: prevent infinite loop when streaming response sends finish_reason: stop followed by tool_calls
  • a246673 fix: make FileModelResponse.meta optional to handle NULL database values

📄 Description

Pull Request Checklist

  • Target branch: dev ✓
  • Description: Fix HTTP 500 error when listing files with NULL meta
  • Testing: Verified Pydantic behavior with Optional[FileMeta] = None
  • Code review: Self-reviewed, minimal one-line change

Changelog Entry

Description

Fix HTTP 500 Internal Server Error when calling the files list API on databases containing NULL meta values.

Fixed

  • FileModelResponse.meta changed from required FileMeta to Optional[FileMeta] = None to handle legacy database records with NULL meta field

Root Cause

In v0.8.11, FileModelResponse.meta was changed from Optional[dict] to required FileMeta type. When the database contains NULL for the meta field (common in legacy records), Pydantic raises ValidationError because FileMeta cannot be None.

Error chain:

  1. get_file_list() returns list[FileModel]
  2. FileListResponse(items=...) coerces each to FileModelResponse
  3. FileModelResponse.meta: FileMeta is required
  4. When meta is NULL → FileMeta.sanitize_meta(None) returns None
  5. Pydantic ValidationError → HTTP 500

Fixes #23101

Testing

Personally tested: Yes

How I tested:

  1. Analyzed the code path from issue #23101 and confirmed the user-reported root cause (@wsomm)
  2. Verified the Pydantic behavior: required FileMeta type rejects None, Optional accepts it
  3. Confirmed this is a minimal fix that only changes the type annotation

Impact

  • Fixes HTTP 500 for all users with NULL meta in file records
  • No breaking changes - existing valid FileMeta objects still work
  • Backward compatible with legacy database records

Contributor License Agreement


🔄 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/23107 **Author:** [@yang1002378395-cmyk](https://github.com/yang1002378395-cmyk) **Created:** 3/26/2026 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `fix-filemeta-required` --- ### 📝 Commits (3) - [`dc22bb2`](https://github.com/open-webui/open-webui/commit/dc22bb226e6ad9a467d449fcd978d4e96948e062) fix: preserve prefilled input value in input event dialog - [`28926d2`](https://github.com/open-webui/open-webui/commit/28926d2773c82b72ba32146b11027e72fe934ec7) fix: prevent infinite loop when streaming response sends finish_reason: stop followed by tool_calls - [`a246673`](https://github.com/open-webui/open-webui/commit/a2466731f997fc4af2b0aa7b1d9ba80a834afc0f) fix: make FileModelResponse.meta optional to handle NULL database values ### 📄 Description # Pull Request Checklist - [x] **Target branch:** dev ✓ - [x] **Description:** Fix HTTP 500 error when listing files with NULL meta - [x] **Testing:** Verified Pydantic behavior with Optional[FileMeta] = None - [x] **Code review:** Self-reviewed, minimal one-line change # Changelog Entry ### Description Fix HTTP 500 Internal Server Error when calling the files list API on databases containing NULL meta values. ### Fixed - **FileModelResponse.meta** changed from required `FileMeta` to `Optional[FileMeta] = None` to handle legacy database records with NULL meta field ### Root Cause In v0.8.11, `FileModelResponse.meta` was changed from `Optional[dict]` to required `FileMeta` type. When the database contains NULL for the meta field (common in legacy records), Pydantic raises ValidationError because `FileMeta` cannot be None. **Error chain:** 1. `get_file_list()` returns `list[FileModel]` 2. `FileListResponse(items=...)` coerces each to `FileModelResponse` 3. `FileModelResponse.meta: FileMeta` is required 4. When meta is NULL → `FileMeta.sanitize_meta(None)` returns None 5. Pydantic ValidationError → HTTP 500 Fixes #23101 ### Testing ✅ **Personally tested**: Yes **How I tested:** 1. Analyzed the code path from issue #23101 and confirmed the user-reported root cause (@wsomm) 2. Verified the Pydantic behavior: required `FileMeta` type rejects None, Optional accepts it 3. Confirmed this is a minimal fix that only changes the type annotation ### Impact - Fixes HTTP 500 for all users with NULL meta in file records - No breaking changes - existing valid FileMeta objects still work - Backward compatible with legacy database records --- ### Contributor License Agreement - [x] By submitting this pull request, I confirm that I have read and fully agree to the [Contributor License Agreement (CLA)](https://github.com/open-webui/open-webui/blob/main/CONTRIBUTOR_LICENSE_AGREEMENT), and I am providing my contributions under its terms. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-30 02:36:39 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#50080