Skip to content

Add LITELLM_DISABLE_LAZY_LOADING env var to fix VCR cassette creation issue#18725

Merged
AlexsanderHamir merged 2 commits intomainfrom
litellm_fix_lazy_loading_issues_001
Jan 6, 2026
Merged

Add LITELLM_DISABLE_LAZY_LOADING env var to fix VCR cassette creation issue#18725
AlexsanderHamir merged 2 commits intomainfrom
litellm_fix_lazy_loading_issues_001

Conversation

@AlexsanderHamir
Copy link
Contributor

Relevant issues

Fixes #18659

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.

Type

🐛 Bug Fix
🧹 Refactoring

Changes

… (issue #18659)

- Add opt-in environment variable LITELLM_DISABLE_LAZY_LOADING to disable lazy loading
- When set, encoding is loaded at import time (pre-#18070 behavior)
- This ensures tiktoken is initialized before VCR starts recording HTTP requests
- Fixes issue where accessing litellm.encoding triggers HTTP request that breaks VCR
- For now, only affects encoding as it was the only reported issue
- Includes comprehensive tests
@vercel
Copy link

vercel bot commented Jan 6, 2026

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

Project Deployment Review Updated (UTC)
litellm Ready Ready Preview, Comment Jan 6, 2026 10:43pm

@AlexsanderHamir AlexsanderHamir merged commit bb4c01f into main Jan 6, 2026
31 of 58 checks passed
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]: #18070 broke VCR cassette creation

1 participant