litellm - ✅(Solved) Fix [Bug]: K8s Migration Job - Read-Only fs [1 pull requests, 1 comments, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
BerriAI/litellm#23445Fetched 2026-04-08 00:44:15
View on GitHub
Comments
1
Participants
1
Timeline
5
Reactions
0
Author
Participants
Timeline (top)
labeled ×3commented ×1cross-referenced ×1

Error Message

Traceback (most recent call last): File "/app/litellm/proxy/prisma_migration.py", line 16, in <module> run_server(["--skip_server_startup"], standalone_mode=False) ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.13/site-packages/click/core.py", line 1157, in call return self.main(*args, **kwargs) ~~~~~~~~~^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.13/site-packages/click/core.py", line 1078, in main rv = self.invoke(ctx) File "/usr/lib/python3.13/site-packages/click/core.py", line 1434, in invoke return ctx.invoke(self.callback, **ctx.params) ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.13/site-packages/click/core.py", line 783, in invoke return __callback(*args, **kwargs) File "/usr/lib/python3.13/site-packages/litellm/proxy/proxy_cli.py", line 558, in run_server from .proxy_server import ( ...<4 lines>... ) File "/usr/lib/python3.13/site-packages/litellm/proxy/proxy_server.py", line 428, in <module> from litellm.proxy.pass_through_endpoints.llm_passthrough_endpoints import ( passthrough_endpoint_router, ) File "/usr/lib/python3.13/site-packages/litellm/proxy/pass_through_endpoints/llm_passthrough_endpoints.py", line 36, in <module> from litellm.proxy.pass_through_endpoints.pass_through_endpoints import ( ...<4 lines>... ) File "/usr/lib/python3.13/site-packages/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py", line 63, in <module> from .streaming_handler import PassThroughStreamingHandler File "/usr/lib/python3.13/site-packages/litellm/proxy/pass_through_endpoints/streaming_handler.py", line 19, in <module> from .llm_provider_handlers.openai_passthrough_logging_handler import ( OpenAIPassthroughLoggingHandler, ) File "/usr/lib/python3.13/site-packages/litellm/proxy/pass_through_endpoints/llm_provider_handlers/openai_passthrough_logging_handler.py", line 25, in <module> from litellm.proxy.pass_through_endpoints.success_handler import ( PassThroughEndpointLogging, ) File "/usr/lib/python3.13/site-packages/litellm/proxy/pass_through_endpoints/success_handler.py", line 25, in <module> from .llm_provider_handlers.gemini_passthrough_logging_handler import ( GeminiPassthroughLoggingHandler, ) File "/usr/lib/python3.13/site-packages/litellm/proxy/pass_through_endpoints/llm_provider_handlers/gemini_passthrough_logging_handler.py", line 10, in <module> from litellm.llms.gemini.videos.transformation import GeminiVideoConfig File "/usr/lib/python3.13/site-packages/litellm/llms/gemini/videos/init.py", line 2, in <module> from .transformation import GeminiVideoConfig File "/usr/lib/python3.13/site-packages/litellm/llms/gemini/videos/transformation.py", line 14, in <module> from litellm.images.utils import ImageEditRequestUtils File "/usr/lib/python3.13/site-packages/litellm/images/utils.py", line 5, in <module> from litellm.litellm_core_utils.token_counter import get_image_type File "/usr/lib/python3.13/site-packages/litellm/litellm_core_utils/token_counter.py", line 31, in <module> from litellm.litellm_core_utils.default_encoding import encoding as default_encoding File "/usr/lib/python3.13/site-packages/litellm/litellm_core_utils/default_encoding.py", line 23, in <module> os.makedirs(filename, exist_ok=True) ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^ File "<frozen os>", line 228, in makedirs OSError: [Errno 30] Read-only file system: '/tmp/tiktoken_cache'

Fix Action

Fix / Workaround

Image: litellm-non_root Version: main-v1.81.14-stable.gpt-5.4-patch7

PR fix notes

PR #22980: fix k8s migration job - create volumes for readonly fs

Description (problem / solution / changelog)

Relevant issues

Fixes migration job when securityContext.readOnlyRootFilesystem: true The job fails due to errror:

    run_server(["--skip_server_startup"], standalone_mode=False)
.
.
.
  File "<frozen os>", line 228, in makedirs
OSError: [Errno 30] Read-only file system: '/tmp/tiktoken_cache'
``

env var: using TIKTOKEN_CACHE_DIR did not fix so adding the same directories listed in the deployment.
/tmp/ is the only folder needed but adding all three for consistency.

image litellm-non_root:main-v1.81.12-stable.1

## Pre-Submission checklist

**Please complete all items before asking a LiteLLM maintainer to review your PR**

- [ x] I have Added testing in the [`tests/test_litellm/`](https://github.com/BerriAI/litellm/tree/main/tests/test_litellm) directory, **Adding at least 1 test is a hard requirement** - [see details](https://docs.litellm.ai/docs/extras/contributing_code)
- [ x] My PR passes all unit tests on [`make test-unit`](https://docs.litellm.ai/docs/extras/contributing_code)
- [ x] My PR's scope is as isolated as possible, it only solves 1 specific problem
- [ x] I have requested a Greptile review by commenting `@greptileai` and received a **Confidence Score of at least 4/5** before requesting a maintainer review

## 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

<!-- Select the type of Pull Request -->
<!-- Keep only the necessary ones -->

🐛 Bug Fix

## Changes

## Changed files

- `deploy/charts/litellm-helm/templates/migrations-job.yaml` (modified, +25/-2)
- `deploy/charts/litellm-helm/tests/migrations-job_tests.yaml` (modified, +78/-1)

Code Example

Traceback (most recent call last):
  File "/app/litellm/proxy/prisma_migration.py", line 16, in <module>
    run_server(["--skip_server_startup"], standalone_mode=False)
    ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3.13/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/usr/lib/python3.13/site-packages/litellm/proxy/proxy_cli.py", line 558, in run_server
    from .proxy_server import (
    ...<4 lines>...
    )
  File "/usr/lib/python3.13/site-packages/litellm/proxy/proxy_server.py", line 428, in <module>
    from litellm.proxy.pass_through_endpoints.llm_passthrough_endpoints import (
        passthrough_endpoint_router,
    )
  File "/usr/lib/python3.13/site-packages/litellm/proxy/pass_through_endpoints/llm_passthrough_endpoints.py", line 36, in <module>
    from litellm.proxy.pass_through_endpoints.pass_through_endpoints import (
    ...<4 lines>...
    )
  File "/usr/lib/python3.13/site-packages/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py", line 63, in <module>
    from .streaming_handler import PassThroughStreamingHandler
  File "/usr/lib/python3.13/site-packages/litellm/proxy/pass_through_endpoints/streaming_handler.py", line 19, in <module>
    from .llm_provider_handlers.openai_passthrough_logging_handler import (
        OpenAIPassthroughLoggingHandler,
    )
  File "/usr/lib/python3.13/site-packages/litellm/proxy/pass_through_endpoints/llm_provider_handlers/openai_passthrough_logging_handler.py", line 25, in <module>
    from litellm.proxy.pass_through_endpoints.success_handler import (
        PassThroughEndpointLogging,
    )
  File "/usr/lib/python3.13/site-packages/litellm/proxy/pass_through_endpoints/success_handler.py", line 25, in <module>
    from .llm_provider_handlers.gemini_passthrough_logging_handler import (
        GeminiPassthroughLoggingHandler,
    )
  File "/usr/lib/python3.13/site-packages/litellm/proxy/pass_through_endpoints/llm_provider_handlers/gemini_passthrough_logging_handler.py", line 10, in <module>
    from litellm.llms.gemini.videos.transformation import GeminiVideoConfig
  File "/usr/lib/python3.13/site-packages/litellm/llms/gemini/videos/__init__.py", line 2, in <module>
    from .transformation import GeminiVideoConfig
  File "/usr/lib/python3.13/site-packages/litellm/llms/gemini/videos/transformation.py", line 14, in <module>
    from litellm.images.utils import ImageEditRequestUtils
  File "/usr/lib/python3.13/site-packages/litellm/images/utils.py", line 5, in <module>
    from litellm.litellm_core_utils.token_counter import get_image_type
  File "/usr/lib/python3.13/site-packages/litellm/litellm_core_utils/token_counter.py", line 31, in <module>
    from litellm.litellm_core_utils.default_encoding import encoding as default_encoding
  File "/usr/lib/python3.13/site-packages/litellm/litellm_core_utils/default_encoding.py", line 23, in <module>
    os.makedirs(filename, exist_ok=True)
    ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen os>", line 228, in makedirs
OSError: [Errno 30] Read-only file system: '/tmp/tiktoken_cache'
RAW_BUFFERClick to expand / collapse

Check for existing issues

  • I have searched the existing issues and checked that my issue is not a duplicate.

What happened?

Image: litellm-non_root Version: main-v1.81.14-stable.gpt-5.4-patch7

Tiktoken is unable to write to fs when helm value:

securityContext.readOnlyRootFilesystem: true

Merge Request to fix: https://github.com/BerriAI/litellm/pull/22980

Steps to Reproduce

  1. Helm values: securityContext.readOnlyRootFilesystem: true && migrationJob.enabled: true

Relevant log output

Traceback (most recent call last):
  File "/app/litellm/proxy/prisma_migration.py", line 16, in <module>
    run_server(["--skip_server_startup"], standalone_mode=False)
    ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3.13/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/usr/lib/python3.13/site-packages/litellm/proxy/proxy_cli.py", line 558, in run_server
    from .proxy_server import (
    ...<4 lines>...
    )
  File "/usr/lib/python3.13/site-packages/litellm/proxy/proxy_server.py", line 428, in <module>
    from litellm.proxy.pass_through_endpoints.llm_passthrough_endpoints import (
        passthrough_endpoint_router,
    )
  File "/usr/lib/python3.13/site-packages/litellm/proxy/pass_through_endpoints/llm_passthrough_endpoints.py", line 36, in <module>
    from litellm.proxy.pass_through_endpoints.pass_through_endpoints import (
    ...<4 lines>...
    )
  File "/usr/lib/python3.13/site-packages/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py", line 63, in <module>
    from .streaming_handler import PassThroughStreamingHandler
  File "/usr/lib/python3.13/site-packages/litellm/proxy/pass_through_endpoints/streaming_handler.py", line 19, in <module>
    from .llm_provider_handlers.openai_passthrough_logging_handler import (
        OpenAIPassthroughLoggingHandler,
    )
  File "/usr/lib/python3.13/site-packages/litellm/proxy/pass_through_endpoints/llm_provider_handlers/openai_passthrough_logging_handler.py", line 25, in <module>
    from litellm.proxy.pass_through_endpoints.success_handler import (
        PassThroughEndpointLogging,
    )
  File "/usr/lib/python3.13/site-packages/litellm/proxy/pass_through_endpoints/success_handler.py", line 25, in <module>
    from .llm_provider_handlers.gemini_passthrough_logging_handler import (
        GeminiPassthroughLoggingHandler,
    )
  File "/usr/lib/python3.13/site-packages/litellm/proxy/pass_through_endpoints/llm_provider_handlers/gemini_passthrough_logging_handler.py", line 10, in <module>
    from litellm.llms.gemini.videos.transformation import GeminiVideoConfig
  File "/usr/lib/python3.13/site-packages/litellm/llms/gemini/videos/__init__.py", line 2, in <module>
    from .transformation import GeminiVideoConfig
  File "/usr/lib/python3.13/site-packages/litellm/llms/gemini/videos/transformation.py", line 14, in <module>
    from litellm.images.utils import ImageEditRequestUtils
  File "/usr/lib/python3.13/site-packages/litellm/images/utils.py", line 5, in <module>
    from litellm.litellm_core_utils.token_counter import get_image_type
  File "/usr/lib/python3.13/site-packages/litellm/litellm_core_utils/token_counter.py", line 31, in <module>
    from litellm.litellm_core_utils.default_encoding import encoding as default_encoding
  File "/usr/lib/python3.13/site-packages/litellm/litellm_core_utils/default_encoding.py", line 23, in <module>
    os.makedirs(filename, exist_ok=True)
    ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen os>", line 228, in makedirs
OSError: [Errno 30] Read-only file system: '/tmp/tiktoken_cache'

What part of LiteLLM is this about?

Proxy

What LiteLLM version are you on ?

1.81.14

Twitter / LinkedIn details

No response

extent analysis

Fix Plan

To resolve the issue, we need to ensure that the tiktoken cache directory is writable. Since the securityContext.readOnlyRootFilesystem is set to true, we can't write to the root filesystem. We have a few options:

  • Set securityContext.readOnlyRootFilesystem to false
  • Use a persistent volume for the tiktoken cache
  • Use a different cache directory that is writable

Here are the steps to implement the second option:

  1. Create a Persistent Volume Claim (PVC): Create a PVC for the tiktoken cache directory.
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: tiktoken-cache-pvc
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi
  1. Mount the PVC to the container: Update the litellm deployment to mount the PVC to the container.
apiVersion: apps/v1
kind: Deployment
metadata:
  name: litellm
spec:
  containers:
  - name: litellm
    volumeMounts:
    - name: tiktoken-cache
      mountPath: /tmp/tiktoken_cache
  volumes:
  - name: tiktoken-cache
    persistentVolumeClaim:
      claimName: tiktoken-cache-pvc
  1. Update the tiktoken cache directory: Update the tiktoken cache directory to use the mounted PVC.
import os

# Update the cache directory to use the mounted PVC
cache_dir = '/tmp/tiktoken_cache'
os.makedirs(cache_dir, exist_ok=True)

Verification

To verify that the fix worked, check the litellm logs for any errors related to the tiktoken cache directory. You can also check the PVC to ensure that it is being used correctly.

Extra Tips

  • Make sure to update the litellm deployment to use the correct PVC.
  • If you are using a different cache directory, make sure to update the tiktoken configuration to use the correct directory.
  • You can also use a different storage solution, such as a StatefulSet, to manage the tiktoken cache directory.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

litellm - ✅(Solved) Fix [Bug]: K8s Migration Job - Read-Only fs [1 pull requests, 1 comments, 1 participants]