[GH-ISSUE #20925] issue: Uploading KB file on current dev / 0dc74a8 fails with 'open_webui.models.files.FileModel' is not mapped #57995

Closed
opened 2026-05-05 22:08:29 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @athoik on GitHub (Jan 25, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/20925

Check Existing Issues

  • I have searched for any existing and/or related issues.
  • I have searched for any existing and/or related discussions.
  • I have also searched in the CLOSED issues AND CLOSED discussions and found no related items (your issue might already be addressed on the development branch!).
  • I am using the latest version of Open WebUI.

Installation Method

Git Clone

Open WebUI Version

v0.7.3-dev-0dc74a8

Ollama Version (if applicable)

No response

Operating System

Debian 12

Browser (if applicable)

Firefox 147

Confirmation

  • I have read and followed all instructions in README.md.
  • I am using the latest version of both Open WebUI and Ollama.
  • I have included the browser console logs.
  • I have included the Docker container logs.
  • I have provided every relevant configuration, setting, and environment variable used in my setup.
  • I have clearly listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup (such as Docker Compose overrides, .env values, browser settings, authentication configurations, etc).
  • I have documented step-by-step reproduction instructions that are precise, sequential, and leave nothing to interpretation. My steps:
  • Start with the initial platform/version/OS and dependencies used,
  • Specify exact install/launch/configure commands,
  • List URLs visited, user input (incl. example values/emails/passwords if needed),
  • Describe all options and toggles enabled or changed,
  • Include any files or environmental changes,
  • Identify the expected and actual result at each stage,
  • Ensure any reasonably skilled user can follow and hit the same issue.

Expected Behavior

Upload a file on KB, as usual.

Actual Behavior

Uploading KB file on latest dev 0dc74a8 fails with error Class 'open_webui.models.files.FileModel' is not mapped

Checkout the v0.7.2 commit 2b26355002 and issue is not happening.

Steps to Reproduce

Fresh install of latest dev on Debian 12 using SQLite and default Content Extraction Engine.

Logs & Screenshots

2026-01-25 11:50:23.723 | INFO     | uvicorn.protocols.http.httptools_impl:send:483 - 127.0.0.1:60248 - "GET /api/v1/files/5918c791-df07-40d9-9c2c-3f4e8407adc3/process/status?stream=true HTTP/1.1" 200
2026-01-25 11:50:23.858 | ERROR    | open_webui.routers.retrieval:process_file:1820 - Class 'open_webui.models.files.FileModel' is not mapped
Traceback (most recent call last):

  File "/home/user/.conda/envs/open-webui/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 3291, in expunge
    state = attributes.instance_state(instance)
            │          │              └ FileModel(id='5918c791-df07-40d9-9c2c-3f4e8407adc3', user_id='b0d6dd70-73a9-40fe-8540-da9e568e7acc', hash=None, filename='tes...
            │          └ operator.attrgetter('_sa_instance_state')
            └ <module 'sqlalchemy.orm.attributes' from '/home/user/.conda/envs/open-webui/lib/python3.11/site-packages/sqlalchemy/orm/attri...
  File "/home/user/.conda/envs/open-webui/lib/python3.11/site-packages/pydantic/main.py", line 1026, in __getattr__
    raise AttributeError(f'{type(self).__name__!r} object has no attribute {item!r}')

AttributeError: 'FileModel' object has no attribute '_sa_instance_state'


The above exception was the direct cause of the following exception:


Traceback (most recent call last):

  File "/home/user/.conda/envs/open-webui/lib/python3.11/threading.py", line 1002, in _bootstrap
    self._bootstrap_inner()
    │    └ <function Thread._bootstrap_inner at 0x7c99ba6b89a0>
    └ <WorkerThread(AnyIO worker thread, started 136994125809344)>
  File "/home/user/.conda/envs/open-webui/lib/python3.11/threading.py", line 1045, in _bootstrap_inner
    self.run()
    │    └ <function WorkerThread.run at 0x7c98706d9bc0>
    └ <WorkerThread(AnyIO worker thread, started 136994125809344)>
  File "/home/user/.conda/envs/open-webui/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 967, in run
    result = context.run(func, *args)
             │       │   │      └ ()
             │       │   └ functools.partial(<function process_uploaded_file at 0x7c9873246d40>, <starlette.requests.Request object at 0x7c98719673d0>, ...
             │       └ <method 'run' of '_contextvars.Context' objects>
             └ <_contextvars.Context object at 0x7c986fa65d00>

  File "/home/user/open-webui/backend/open_webui/routers/files.py", line 189, in process_uploaded_file
    _process_handler(db_session)
    │                └ <sqlalchemy.orm.session.Session object at 0x7c9870aa2f50>
    └ <function process_uploaded_file.<locals>._process_handler at 0x7c9870693f60>

  File "/home/user/open-webui/backend/open_webui/routers/files.py", line 153, in _process_handler
    process_file(
    └ <function process_file at 0x7c9873246520>

> File "/home/user/open-webui/backend/open_webui/routers/retrieval.py", line 1817, in process_file
    raise e
          └ UnmappedInstanceError("Class 'open_webui.models.files.FileModel' is not mapped")

  File "/home/user/open-webui/backend/open_webui/routers/retrieval.py", line 1771, in process_file
    db.expunge(file)
    │  │       └ FileModel(id='5918c791-df07-40d9-9c2c-3f4e8407adc3', user_id='b0d6dd70-73a9-40fe-8540-da9e568e7acc', hash=None, filename='tes...
    │  └ <function Session.expunge at 0x7c98dea93b00>
    └ <sqlalchemy.orm.session.Session object at 0x7c9870aa2f50>

  File "/home/user/.conda/envs/open-webui/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 3293, in expunge
    raise exc.UnmappedInstanceError(instance) from err
          │   │                     └ FileModel(id='5918c791-df07-40d9-9c2c-3f4e8407adc3', user_id='b0d6dd70-73a9-40fe-8540-da9e568e7acc', hash=None, filename='tes...
          │   └ <class 'sqlalchemy.orm.exc.UnmappedInstanceError'>
          └ <module 'sqlalchemy.orm.exc' from '/home/user/.conda/envs/open-webui/lib/python3.11/site-packages/sqlalchemy/orm/exc.py'>

sqlalchemy.orm.exc.UnmappedInstanceError: Class 'open_webui.models.files.FileModel' is not mapped
2026-01-25 11:50:24.146 | ERROR    | open_webui.routers.files:_process_handler:175 - Error processing file: 5918c791-df07-40d9-9c2c-3f4e8407adc3

Additional Information

No response

Originally created by @athoik on GitHub (Jan 25, 2026). Original GitHub issue: https://github.com/open-webui/open-webui/issues/20925 ### Check Existing Issues - [x] I have searched for any existing and/or related issues. - [x] I have searched for any existing and/or related discussions. - [x] I have also searched in the CLOSED issues AND CLOSED discussions and found no related items (your issue might already be addressed on the development branch!). - [x] I am using the latest version of Open WebUI. ### Installation Method Git Clone ### Open WebUI Version v0.7.3-dev-0dc74a8 ### Ollama Version (if applicable) _No response_ ### Operating System Debian 12 ### Browser (if applicable) Firefox 147 ### Confirmation - [x] I have read and followed all instructions in `README.md`. - [x] I am using the latest version of **both** Open WebUI and Ollama. - [x] I have included the browser console logs. - [x] I have included the Docker container logs. - [x] I have **provided every relevant configuration, setting, and environment variable used in my setup.** - [x] I have clearly **listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup** (such as Docker Compose overrides, .env values, browser settings, authentication configurations, etc). - [x] I have documented **step-by-step reproduction instructions that are precise, sequential, and leave nothing to interpretation**. My steps: - Start with the initial platform/version/OS and dependencies used, - Specify exact install/launch/configure commands, - List URLs visited, user input (incl. example values/emails/passwords if needed), - Describe all options and toggles enabled or changed, - Include any files or environmental changes, - Identify the expected and actual result at each stage, - Ensure any reasonably skilled user can follow and hit the same issue. ### Expected Behavior Upload a file on KB, as usual. ### Actual Behavior Uploading KB file on latest dev [0dc74a8](https://github.com/open-webui/open-webui/commit/0dc74a8a2e7adb76fb503ef0cd3c02daddd2f4bb) fails with error Class 'open_webui.models.files.FileModel' is not mapped Checkout the v0.7.2 commit 2b26355002064228e9b671339f8f3fb9d1fafa73 and issue is not happening. ### Steps to Reproduce Fresh install of latest dev on Debian 12 using SQLite and default Content Extraction Engine. ### Logs & Screenshots ``` 2026-01-25 11:50:23.723 | INFO | uvicorn.protocols.http.httptools_impl:send:483 - 127.0.0.1:60248 - "GET /api/v1/files/5918c791-df07-40d9-9c2c-3f4e8407adc3/process/status?stream=true HTTP/1.1" 200 2026-01-25 11:50:23.858 | ERROR | open_webui.routers.retrieval:process_file:1820 - Class 'open_webui.models.files.FileModel' is not mapped Traceback (most recent call last): File "/home/user/.conda/envs/open-webui/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 3291, in expunge state = attributes.instance_state(instance) │ │ └ FileModel(id='5918c791-df07-40d9-9c2c-3f4e8407adc3', user_id='b0d6dd70-73a9-40fe-8540-da9e568e7acc', hash=None, filename='tes... │ └ operator.attrgetter('_sa_instance_state') └ <module 'sqlalchemy.orm.attributes' from '/home/user/.conda/envs/open-webui/lib/python3.11/site-packages/sqlalchemy/orm/attri... File "/home/user/.conda/envs/open-webui/lib/python3.11/site-packages/pydantic/main.py", line 1026, in __getattr__ raise AttributeError(f'{type(self).__name__!r} object has no attribute {item!r}') AttributeError: 'FileModel' object has no attribute '_sa_instance_state' The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/home/user/.conda/envs/open-webui/lib/python3.11/threading.py", line 1002, in _bootstrap self._bootstrap_inner() │ └ <function Thread._bootstrap_inner at 0x7c99ba6b89a0> └ <WorkerThread(AnyIO worker thread, started 136994125809344)> File "/home/user/.conda/envs/open-webui/lib/python3.11/threading.py", line 1045, in _bootstrap_inner self.run() │ └ <function WorkerThread.run at 0x7c98706d9bc0> └ <WorkerThread(AnyIO worker thread, started 136994125809344)> File "/home/user/.conda/envs/open-webui/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 967, in run result = context.run(func, *args) │ │ │ └ () │ │ └ functools.partial(<function process_uploaded_file at 0x7c9873246d40>, <starlette.requests.Request object at 0x7c98719673d0>, ... │ └ <method 'run' of '_contextvars.Context' objects> └ <_contextvars.Context object at 0x7c986fa65d00> File "/home/user/open-webui/backend/open_webui/routers/files.py", line 189, in process_uploaded_file _process_handler(db_session) │ └ <sqlalchemy.orm.session.Session object at 0x7c9870aa2f50> └ <function process_uploaded_file.<locals>._process_handler at 0x7c9870693f60> File "/home/user/open-webui/backend/open_webui/routers/files.py", line 153, in _process_handler process_file( └ <function process_file at 0x7c9873246520> > File "/home/user/open-webui/backend/open_webui/routers/retrieval.py", line 1817, in process_file raise e └ UnmappedInstanceError("Class 'open_webui.models.files.FileModel' is not mapped") File "/home/user/open-webui/backend/open_webui/routers/retrieval.py", line 1771, in process_file db.expunge(file) │ │ └ FileModel(id='5918c791-df07-40d9-9c2c-3f4e8407adc3', user_id='b0d6dd70-73a9-40fe-8540-da9e568e7acc', hash=None, filename='tes... │ └ <function Session.expunge at 0x7c98dea93b00> └ <sqlalchemy.orm.session.Session object at 0x7c9870aa2f50> File "/home/user/.conda/envs/open-webui/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 3293, in expunge raise exc.UnmappedInstanceError(instance) from err │ │ └ FileModel(id='5918c791-df07-40d9-9c2c-3f4e8407adc3', user_id='b0d6dd70-73a9-40fe-8540-da9e568e7acc', hash=None, filename='tes... │ └ <class 'sqlalchemy.orm.exc.UnmappedInstanceError'> └ <module 'sqlalchemy.orm.exc' from '/home/user/.conda/envs/open-webui/lib/python3.11/site-packages/sqlalchemy/orm/exc.py'> sqlalchemy.orm.exc.UnmappedInstanceError: Class 'open_webui.models.files.FileModel' is not mapped 2026-01-25 11:50:24.146 | ERROR | open_webui.routers.files:_process_handler:175 - Error processing file: 5918c791-df07-40d9-9c2c-3f4e8407adc3 ``` ### Additional Information _No response_
GiteaMirror added the bugconfirmed issue labels 2026-05-05 22:08:29 -05:00
Author
Owner

@owui-terminator[bot] commented on GitHub (Jan 25, 2026):

🔍 Similar Issues Found

I found some existing issues that might be related to this one. Please check if any of these are duplicates or contain helpful solutions:

  1. #20544 issue: Document uploading - Docling API
    by n4gY1 • Jan 10, 2026 • bug

  2. #20361 Issue: Large-scale model setting-related functionality fails.
    by shentong0722 • Jan 04, 2026 • bug

  3. #20730 issue: API to knowledge doesn't list files
    by sigi77 • Jan 16, 2026 • bug

  4. #20676 issue: Cloud models fail to use native tools
    by 0x7CFE • Jan 15, 2026 • bug


💡 Tips:

  • If this is a duplicate, please consider closing this issue and adding any additional details to the existing one
  • If you found a solution in any of these issues, please share it here to help others

This comment was generated automatically by a bot. Please react with a 👍 if this comment was helpful, or a 👎 if it was not.

<!-- gh-comment-id:3796420241 --> @owui-terminator[bot] commented on GitHub (Jan 25, 2026): 🔍 **Similar Issues Found** I found some existing issues that might be related to this one. Please check if any of these are duplicates or contain helpful solutions: 1. [#20544](https://github.com/open-webui/open-webui/issues/20544) **issue: Document uploading - Docling API** *by n4gY1 • Jan 10, 2026 • `bug`* 2. [#20361](https://github.com/open-webui/open-webui/issues/20361) **Issue: Large-scale model setting-related functionality fails.** *by shentong0722 • Jan 04, 2026 • `bug`* 3. [#20730](https://github.com/open-webui/open-webui/issues/20730) **issue: API to knowledge doesn't list files** *by sigi77 • Jan 16, 2026 • `bug`* 4. [#20676](https://github.com/open-webui/open-webui/issues/20676) **issue: Cloud models fail to use native tools** *by 0x7CFE • Jan 15, 2026 • `bug`* --- 💡 **Tips:** - If this is a duplicate, please consider closing this issue and adding any additional details to the existing one - If you found a solution in any of these issues, please share it here to help others *This comment was generated automatically by a bot.* Please react with a 👍 if this comment was helpful, or a 👎 if it was not.
Author
Owner

@silentoplayz commented on GitHub (Jan 25, 2026):

I can confirm this issue exists on the latest dev branch and it's preventing me from using anything in Open WebUI that would use the RAG engine.

Image Image Image
<!-- gh-comment-id:3796638654 --> @silentoplayz commented on GitHub (Jan 25, 2026): I can confirm this issue exists on the latest `dev` branch and it's preventing me from using *anything* in Open WebUI that would use the RAG engine. <img width="2306" height="1276" alt="Image" src="https://github.com/user-attachments/assets/07346564-bbc9-4ba0-9267-e3862cb945c5" /> <img width="2560" height="1281" alt="Image" src="https://github.com/user-attachments/assets/335e0e21-b3cf-45da-ab49-f9a6752902a0" /> <img width="1838" height="1099" alt="Image" src="https://github.com/user-attachments/assets/5b2b8a55-cae0-40a5-b677-31f508e62748" />
Author
Owner

@Classic298 commented on GitHub (Jan 25, 2026):

https://github.com/open-webui/open-webui/pull/20931

this should fix it

<!-- gh-comment-id:3796815469 --> @Classic298 commented on GitHub (Jan 25, 2026): https://github.com/open-webui/open-webui/pull/20931 this should fix it
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#57995