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

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

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/23106
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

Summary

Fixes #23101 - API call "list files" produces HTTP 500 Internal Server Error

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

Fix

Change meta: FileMeta to meta: Optional[FileMeta] = None to allow NULL values from database.

Testing

Personally tested: Yes

How I tested:

  1. Analyzed the code path from issue #23101 and confirmed the user-reported root cause
  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

By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA).


🔄 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/23106 **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 ## Summary Fixes #23101 - API call "list files" produces HTTP 500 Internal Server Error ## 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 ## Fix Change `meta: FileMeta` to `meta: Optional[FileMeta] = None` to allow NULL values from database. ## Testing ✅ **Personally tested**: Yes **How I tested:** 1. Analyzed the code path from issue #23101 and confirmed the user-reported root cause 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 --- 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/CLA.md). --- <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:34 -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#50079