fix: resolve Read-only file system error in non-root images#19449
Merged
krrishdholakia merged 1 commit intoBerriAI:litellm_staging_01_21_2026from Jan 21, 2026
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
3c31487
into
BerriAI:litellm_staging_01_21_2026
3 of 7 checks passed
Comment on lines
+18
to
+24
| # Check if the directory is writable. If not, use /tmp as a fallback. | ||
| # This is especially important for non-root Docker environments where the package directory is read-only. | ||
| is_non_root = os.getenv("LITELLM_NON_ROOT", "").lower() == "true" | ||
| if not os.access(filename, os.W_OK) and is_non_root: | ||
| filename = "/tmp/tiktoken_cache" | ||
| os.makedirs(filename, exist_ok=True) | ||
|
|
Contributor
There was a problem hiding this comment.
@Harshit28j why does this change this code, seems unrelated to the issue the PR is trying to fix, no? FWIW, it regresses #1071 for us
Contributor
There was a problem hiding this comment.
Isn't the cache already populated with the tokenizer (eg https://github.com/BerriAI/litellm/tree/v1.81.3.rc.2/litellm/litellm_core_utils/tokenizers), and so you don't need to re-download ?
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Relevant issues
Fixes #19425 (UI for Non-Root Docker Does Not Show on v1.80.15)
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
tests/litellm/directory, Adding at least 1 test is a hard requirement - see detailsmake test-unitCI (LiteLLM team)
Branch creation CI run
Link:
CI run for the last commit
Link:
Merge / cherry-pick CI run
Links:
Type
🐛 Bug Fix
Changes
LITELLM_NON_ROOT=trueand the UI path is/var/lib/litellm/ui. This preventsOSError: [Errno 30] Read-only file systemcrashes on startup in non-root Docker images where the UI is already pre-built./tmp/tiktoken_cacheas a fallback when the defaultsite-packagesdirectory is not writable. This fixesPermissionErrorin non-root environments.tests/test_default_encoding_non_root.py: Verifies tiktoken fallback logic.