Skip to content

fix: resolve Read-only file system error in non-root images#19449

Merged
krrishdholakia merged 1 commit intoBerriAI:litellm_staging_01_21_2026from
Harshit28j:fix/ui-not-appear
Jan 21, 2026
Merged

fix: resolve Read-only file system error in non-root images#19449
krrishdholakia merged 1 commit intoBerriAI:litellm_staging_01_21_2026from
Harshit28j:fix/ui-not-appear

Conversation

@Harshit28j
Copy link
Collaborator

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

  • I have Added testing in the tests/litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem

CI (LiteLLM team)

CI status guideline:

  • 50-55 passing tests: main is stable with minor issues.
  • 45-49 passing tests: acceptable but needs attention
  • <= 40 passing tests: unstable; be careful with your merges and assess the risk.
  • Branch creation CI run
    Link:

  • CI run for the last commit
    Link:

  • Merge / cherry-pick CI run
    Links:

Type

🐛 Bug Fix

Changes

  1. Skip Runtime UI Restructuring: Modified proxy_server.py to prevent _restructure_ui_html_files from running when LITELLM_NON_ROOT=true and the UI path is /var/lib/litellm/ui. This prevents OSError: [Errno 30] Read-only file system crashes on startup in non-root Docker images where the UI is already pre-built.
  2. Tiktoken Cache Fallback: Updated default_encoding.py to use /tmp/tiktoken_cache as a fallback when the default site-packages directory is not writable. This fixes PermissionError in non-root environments.
  3. Added Tests:
    • tests/test_proxy_server_non_root.py: Verifies UI skipping logic.
    • tests/test_default_encoding_non_root.py: Verifies tiktoken fallback logic.

@vercel
Copy link

vercel bot commented Jan 20, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
litellm Error Error Jan 20, 2026 11:57pm

Request Review

@krrishdholakia krrishdholakia changed the base branch from main to litellm_staging_01_21_2026 January 21, 2026 02:43
@krrishdholakia krrishdholakia merged commit 3c31487 into BerriAI:litellm_staging_01_21_2026 Jan 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)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: UI for Non-Root Docker Does Not Show on v1.80.15

3 participants