[GH-ISSUE #12430] issue: Incorrect cache_dir setting in get_model_path causes "Cannot find an appropriate cached snapshot folder" #16598

Closed
opened 2026-04-19 22:29:41 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @alecswan on GitHub (Apr 4, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/12430

Check Existing Issues

  • I have searched the existing issues and discussions.
  • I am using the latest version of Open WebUI.

Installation Method

Docker

Open WebUI Version

v0.6.0

Ollama Version (if applicable)

No response

Operating System

ghcr.io/open-webui/open-webui:0.6.0

Browser (if applicable)

No response

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 listed steps to reproduce the bug in detail.

Expected Behavior

openwebui-1 | DEBUG [open_webui.retrieval.utils] model: sentence-transformers/all-MiniLM-L6-v2
openwebui-1 | DEBUG [open_webui.retrieval.utils] snapshot_kwargs: {'cache_dir': '/app/backend/data/cache/embedding/models/hub', 'local_files_only': True}
openwebui-1 | DEBUG [open_webui.retrieval.utils] model_repo_path: /app/backend/data/cache/embedding/models/hub/models--sentence-transformers--all-MiniLM-L6-v2/snapshots/c9745ed1d9f207416be6d2e6f8de32d1f16199bf

Actual Behavior

openwebui-1 | DEBUG [open_webui.retrieval.utils] model: sentence-transformers/all-MiniLM-L6-v2
openwebui-1 | DEBUG [open_webui.retrieval.utils] snapshot_kwargs: {'cache_dir': '/app/backend/data/cache/embedding/models', 'local_files_only': True}
openwebui-1 | ERROR [open_webui.retrieval.utils] Cannot determine model snapshot path: Cannot find an appropriate cached snapshot folder for the specified revision on the local disk and outgoing traffic has been disabled. To enable repo look-ups and downloads online, pass 'local_files_only=False' as input.
openwebui-1 | Traceback (most recent call last):
openwebui-1 | File "/app/backend/open_webui/retrieval/utils.py", line 596, in get_model_path
openwebui-1 | model_repo_path = snapshot_download(**snapshot_kwargs)
openwebui-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
openwebui-1 | File "/usr/local/lib/python3.11/site-packages/huggingface_hub/utils/_validators.py", line 114, in _inner_fn
openwebui-1 | return fn(*args, **kwargs)
openwebui-1 | ^^^^^^^^^^^^^^^^^^^
openwebui-1 | File "/usr/local/lib/python3.11/site-packages/huggingface_hub/_snapshot_download.py", line 219, in snapshot_download
openwebui-1 | raise LocalEntryNotFoundError(
openwebui-1 | huggingface_hub.errors.LocalEntryNotFoundError: Cannot find an appropriate cached snapshot folder for the specified revision on the local disk and outgoing traffic has been disabled. To enable repo look-ups and downloads online, pass 'local_files_only=False' as input.

Steps to Reproduce

  1. Start openwebui docker container
  2. Jump on the container and manually install sentence-transformers/all-MiniLM-L6-v2
python3 -c "from huggingface_hub import snapshot_download; import logging; logging.basicConfig(level=logging.INFO); snapshot_download(repo_id='sentence-transformers/all-MiniLM-L6-v2', revision='main', local_files_only=False, local_dir_use_symlinks=False)"
  1. Switch to offline mode by setting the following env vars
export HF_HUB_OFFLINE=1
export OFFLINE_MODE=True
  1. Restart openwebui docker container

Logs & Screenshots

See logs in Expected and Actual Behavior sections

Additional Information

openwebui docker container has the following env var set by default
HF_HOME=/app/backend/data/cache/embedding/models
SENTENCE_TRANSFORMERS_HOME=/app/backend/data/cache/embedding/models

NOTE that the same value for both env vars

The root cause here is that running snapshot_download(..) method manually will store models in hub/ subfolder of the directory where both env vars are pointing. However, get_model_path(..) will try to load the model from the directory itself, not hub/ subfolder, because it sets cache_dir = os.getenv("SENTENCE_TRANSFORMERS_HOME")

My workaround was "export SENTENCE_TRANSFORMERS_HOME=${HF_HOME}/hub" but this feels kludgy.

The bug is in cache_dir = os.getenv("SENTENCE_TRANSFORMERS_HOME") line. One way to fix it is to not set cache_dir at all and let huggingface_hub.snapshot_download(..) method resolve the cache dir as it typically does. Alternatively, you could set cache_dir=os.getenv("HF_HUB_CACHE") ? os.getenv("SENTENCE_TRANSFORMERS_HOME") in an attempt to provide some level of backward-compatibility in case somebody is using my workaround.

Originally created by @alecswan on GitHub (Apr 4, 2025). Original GitHub issue: https://github.com/open-webui/open-webui/issues/12430 ### Check Existing Issues - [x] I have searched the existing issues and discussions. - [x] I am using the latest version of Open WebUI. ### Installation Method Docker ### Open WebUI Version v0.6.0 ### Ollama Version (if applicable) _No response_ ### Operating System ghcr.io/open-webui/open-webui:0.6.0 ### Browser (if applicable) _No response_ ### 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. - [ ] I have included the browser console logs. - [x] I have included the Docker container logs. - [x] I have listed steps to reproduce the bug in detail. ### Expected Behavior openwebui-1 | DEBUG [open_webui.retrieval.utils] model: sentence-transformers/all-MiniLM-L6-v2 openwebui-1 | DEBUG [open_webui.retrieval.utils] snapshot_kwargs: {'cache_dir': '/app/backend/data/cache/embedding/models/hub', 'local_files_only': True} openwebui-1 | DEBUG [open_webui.retrieval.utils] model_repo_path: /app/backend/data/cache/embedding/models/hub/models--sentence-transformers--all-MiniLM-L6-v2/snapshots/c9745ed1d9f207416be6d2e6f8de32d1f16199bf ### Actual Behavior openwebui-1 | DEBUG [open_webui.retrieval.utils] model: sentence-transformers/all-MiniLM-L6-v2 openwebui-1 | DEBUG [open_webui.retrieval.utils] snapshot_kwargs: {'cache_dir': '/app/backend/data/cache/embedding/models', 'local_files_only': True} openwebui-1 | ERROR [open_webui.retrieval.utils] Cannot determine model snapshot path: Cannot find an appropriate cached snapshot folder for the specified revision on the local disk and outgoing traffic has been disabled. To enable repo look-ups and downloads online, pass 'local_files_only=False' as input. openwebui-1 | Traceback (most recent call last): openwebui-1 | File "/app/backend/open_webui/retrieval/utils.py", line 596, in get_model_path openwebui-1 | model_repo_path = snapshot_download(**snapshot_kwargs) openwebui-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ openwebui-1 | File "/usr/local/lib/python3.11/site-packages/huggingface_hub/utils/_validators.py", line 114, in _inner_fn openwebui-1 | return fn(*args, **kwargs) openwebui-1 | ^^^^^^^^^^^^^^^^^^^ openwebui-1 | File "/usr/local/lib/python3.11/site-packages/huggingface_hub/_snapshot_download.py", line 219, in snapshot_download openwebui-1 | raise LocalEntryNotFoundError( openwebui-1 | huggingface_hub.errors.LocalEntryNotFoundError: Cannot find an appropriate cached snapshot folder for the specified revision on the local disk and outgoing traffic has been disabled. To enable repo look-ups and downloads online, pass 'local_files_only=False' as input. ### Steps to Reproduce 1. Start openwebui docker container 2. Jump on the container and manually install sentence-transformers/all-MiniLM-L6-v2 ``` python3 -c "from huggingface_hub import snapshot_download; import logging; logging.basicConfig(level=logging.INFO); snapshot_download(repo_id='sentence-transformers/all-MiniLM-L6-v2', revision='main', local_files_only=False, local_dir_use_symlinks=False)" ``` 3. Switch to offline mode by setting the following env vars ``` export HF_HUB_OFFLINE=1 export OFFLINE_MODE=True ``` 4. Restart openwebui docker container ### Logs & Screenshots See logs in Expected and Actual Behavior sections ### Additional Information openwebui docker container has the following env var set by default HF_HOME=/app/backend/data/cache/embedding/models SENTENCE_TRANSFORMERS_HOME=/app/backend/data/cache/embedding/models NOTE that the same value for both env vars The root cause here is that running snapshot_download(..) method manually will store models in hub/ subfolder of the directory where both env vars are pointing. However, [get_model_path](https://github.com/open-webui/open-webui/blob/04799f1f95f958674d35ba4854ef62754a4d332e/backend/open_webui/retrieval/utils.py#L565)(..) will try to load the model from the directory itself, not hub/ subfolder, because it sets `cache_dir = os.getenv("SENTENCE_TRANSFORMERS_HOME")` My workaround was "export SENTENCE_TRANSFORMERS_HOME=${HF_HOME}**/hub**" but this feels kludgy. The bug is in `cache_dir = os.getenv("SENTENCE_TRANSFORMERS_HOME")` line. One way to fix it is to not set cache_dir at all and let huggingface_hub.snapshot_download(..) method resolve the cache dir as it typically does. Alternatively, you could set `cache_dir=os.getenv("HF_HUB_CACHE") ? os.getenv("SENTENCE_TRANSFORMERS_HOME")` in an attempt to provide some level of backward-compatibility in case somebody is using my workaround.
GiteaMirror added the bug label 2026-04-19 22:29:41 -05:00
Author
Owner

@tjbck commented on GitHub (Apr 4, 2025):

Intended behaviour.

<!-- gh-comment-id:2778807901 --> @tjbck commented on GitHub (Apr 4, 2025): Intended behaviour.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#16598