Skip to content

fix(proxy): return early instead of raising ValueError when standard_logging_payload is missing#20851

Merged
krrishdholakia merged 17 commits intoBerriAI:litellm_oss_staging_02_10_2026from
themavik:fix-budget-limiter-missing-payload
Feb 10, 2026
Merged

fix(proxy): return early instead of raising ValueError when standard_logging_payload is missing#20851
krrishdholakia merged 17 commits intoBerriAI:litellm_oss_staging_02_10_2026from
themavik:fix-budget-limiter-missing-payload

Conversation

@themavik
Copy link
Contributor

Summary

Fixes #18986

The _PROXY_VirtualKeyModelMaxBudgetLimiter.async_log_success_event callback raises a ValueError when standard_logging_payload is None. This happens for non-standard endpoints like the vLLM /classify passthrough, which do not populate standard_logging_object in kwargs.

The raised exception:

  1. Produces noisy error logs (LiteLLM.LoggingError: [Non-Blocking])
  2. Disrupts downstream success callbacks (e.g. Langfuse fails to log the request)

Changes

Changed the raise ValueError to an early return with a debug log, matching the existing defensive pattern used a few lines later for missing user_api_key_model_max_budget (lines 163-171 of the same method).

Test plan

  • vLLM /classify endpoint calls should no longer produce ValueError: standard_logging_payload is required in logs
  • Downstream callbacks like Langfuse should run normally for these endpoints
  • Standard chat/completion endpoints are unaffected since they always populate standard_logging_payload

Sameerlite and others added 17 commits January 15, 2026 13:30
…788)

* add has_client_credentials

* MCPOAuth2TokenCache

* init MCP Oauth2 constants

* MCPOAuth2TokenCache

* resolve_mcp_auth

* test fixes

* docs fix

* address greptile review: min TTL, env-configurable constants, tests, docs

- Fix zero-TTL edge case: floor at MCP_OAUTH2_TOKEN_CACHE_MIN_TTL (10s)
- Make all MCP OAuth2 constants env-configurable via os.getenv()
- Move test file to follow 1:1 mapping convention (test_oauth2_token_cache.py)
- Add MCP OAuth doc page (mcp_oauth.md) with M2M and PKCE sections
- Update FAQ in mcp.md to reflect M2M support
- Add E2E test script and config

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix mypy lint

* fix oauth2

* remove old files

* docs fix

* address greptile comments

* fix: atomic lock creation + validate JSON response shape

- Use dict.setdefault() for atomic per-server lock creation
- Add isinstance(body, dict) check before accessing token response fields

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: replace asserts with proper guards, wrap HTTP errors with context

- Replace `assert` statements with `if/raise ValueError` (asserts can be
  disabled with python -O in production)
- Wrap `httpx.HTTPStatusError` to provide a clear error message with
  server_id and status code
- Add tests for HTTP error and non-dict JSON response error paths
- Remove unused imports

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
[Feature] UI - Invite User: Email Integration Alert
* add has_client_credentials

* MCPOAuth2TokenCache

* init MCP Oauth2 constants

* MCPOAuth2TokenCache

* resolve_mcp_auth

* test fixes

* docs fix

* address greptile review: min TTL, env-configurable constants, tests, docs

- Fix zero-TTL edge case: floor at MCP_OAUTH2_TOKEN_CACHE_MIN_TTL (10s)
- Make all MCP OAuth2 constants env-configurable via os.getenv()
- Move test file to follow 1:1 mapping convention (test_oauth2_token_cache.py)
- Add MCP OAuth doc page (mcp_oauth.md) with M2M and PKCE sections
- Update FAQ in mcp.md to reflect M2M support
- Add E2E test script and config

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix mypy lint

* fix oauth2

* ui feat fixes

* test M2M

* test fix

* ui feats

* ui fixes

* ui fix client ID

* fix: backend endpoints

* docs fix

* fixes greptile

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
…loyment custom pricing (#20679)

* bug: custom price override for models

* added associated test
…nd" (#20784)

When MCP SDK hits root-level /register, /authorize, /token without
server name prefix, auto-resolve to the single configured OAuth2
server. Also fix WWW-Authenticate header to use correct public URL
behind reverse proxy.
fix: Preserved nullable object fields by carrying schema properties
Add support for langchain_aws via litellm passthrough
…logging_payload is missing

The `_PROXY_VirtualKeyModelMaxBudgetLimiter.async_log_success_event` hook
raises `ValueError` when `standard_logging_payload` is `None`.  This breaks
non-standard call types (e.g. vLLM `/classify`) that do not populate the
payload, and the resulting exception disrupts downstream success callbacks
like Langfuse.

Return early with a debug log instead, matching the existing pattern used
for missing `user_api_key_model_max_budget`.

Fixes #18986
@vercel
Copy link

vercel bot commented Feb 10, 2026

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

Project Deployment Actions Updated (UTC)
litellm Ready Ready Preview, Comment Feb 10, 2026 10:41am

Request Review

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 10, 2026

Greptile Overview

Greptile Summary

This PR updates the proxy hook _PROXY_VirtualKeyModelMaxBudgetLimiter.async_log_success_event to treat a missing standard_logging_payload as a non-actionable condition: it now logs at debug level and returns early rather than raising ValueError. This aligns with the method’s existing defensive behavior for other missing optional inputs (e.g., absent max-budget metadata) and prevents the hook from emitting noisy non-blocking logging errors.

In the broader proxy callback chain, this change ensures non-standard/passthrough endpoints that don’t populate the standard logging object (e.g., vLLM /classify) won’t interrupt the remaining success callbacks (such as Langfuse logging), while standard chat/completion flows continue unchanged because they already provide standard_logging_payload.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk.
  • The change is narrowly scoped (error-on-missing-input to early return) within a non-blocking logging hook, aligns with existing defensive patterns in the same method, and reduces unwanted exceptions without affecting standard request flows that already provide the payload.
  • No files require special attention

Important Files Changed

Filename Overview
litellm/proxy/hooks/model_max_budget_limiter.py Replaces a ValueError on missing standard_logging_payload with an early return and debug log in async_log_success_event to avoid noisy errors and allow downstream callbacks to proceed.

Sequence Diagram

sequenceDiagram
    participant Proxy as LiteLLM Proxy
    participant Hook as _PROXY_VirtualKeyModelMaxBudgetLimiter
    participant Other as Downstream Success Callbacks

    Proxy->>Hook: async_log_success_event(kwargs)
    alt standard_logging_payload missing (None)
        Hook->>Hook: debug log + early return
        Hook-->>Proxy: returns (no exception)
        Proxy->>Other: continue running callbacks
    else standard_logging_payload present
        Hook->>Hook: extract user_api_key_model_max_budget
        alt max budget missing
            Hook->>Hook: debug log + early return
        else max budget present
            Hook->>Hook: update usage/budget state
        end
        Hook-->>Proxy: returns
        Proxy->>Other: continue running callbacks
    end
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

@krrishdholakia
Copy link
Member

Hi @themavik thank you for your work. Are you looking for new opportunities at the moment?

@krrishdholakia krrishdholakia changed the base branch from main to litellm_oss_staging_02_10_2026 February 10, 2026 17:07
@krrishdholakia krrishdholakia merged commit 8d8e873 into BerriAI:litellm_oss_staging_02_10_2026 Feb 10, 2026
7 of 8 checks passed
@themavik
Copy link
Contributor Author

Hi @themavik thank you for your work. Are you looking for new opportunities at the moment?

Hi @krrishdholakia , thank you for reaching out! Yes, I am currently open to new opportunities and would love to hear more about what you have in mind.

Sameerlite added a commit that referenced this pull request Feb 11, 2026
…logging_payload is missing (#20851)

* fix: Preserved nullable object fields by carrying schema properties

* Fix: _convert_schema_types

* Fix all mypy issues

* Add alert about email notifications

* fixing tests

* extending timeout for long running tests

* Text changes

* [Feat] MCP Oauth2 Fixes - Add support for MCP M2M Oauth2 support (#20788)

* add has_client_credentials

* MCPOAuth2TokenCache

* init MCP Oauth2 constants

* MCPOAuth2TokenCache

* resolve_mcp_auth

* test fixes

* docs fix

* address greptile review: min TTL, env-configurable constants, tests, docs

- Fix zero-TTL edge case: floor at MCP_OAUTH2_TOKEN_CACHE_MIN_TTL (10s)
- Make all MCP OAuth2 constants env-configurable via os.getenv()
- Move test file to follow 1:1 mapping convention (test_oauth2_token_cache.py)
- Add MCP OAuth doc page (mcp_oauth.md) with M2M and PKCE sections
- Update FAQ in mcp.md to reflect M2M support
- Add E2E test script and config

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix mypy lint

* fix oauth2

* remove old files

* docs fix

* address greptile comments

* fix: atomic lock creation + validate JSON response shape

- Use dict.setdefault() for atomic per-server lock creation
- Add isinstance(body, dict) check before accessing token response fields

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: replace asserts with proper guards, wrap HTTP errors with context

- Replace `assert` statements with `if/raise ValueError` (asserts can be
  disabled with python -O in production)
- Wrap `httpx.HTTPStatusError` to provide a clear error message with
  server_id and status code
- Add tests for HTTP error and non-dict JSON response error paths
- Remove unused imports

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

* [UI] M2M OAuth2 UI Flow  (#20794)

* add has_client_credentials

* MCPOAuth2TokenCache

* init MCP Oauth2 constants

* MCPOAuth2TokenCache

* resolve_mcp_auth

* test fixes

* docs fix

* address greptile review: min TTL, env-configurable constants, tests, docs

- Fix zero-TTL edge case: floor at MCP_OAUTH2_TOKEN_CACHE_MIN_TTL (10s)
- Make all MCP OAuth2 constants env-configurable via os.getenv()
- Move test file to follow 1:1 mapping convention (test_oauth2_token_cache.py)
- Add MCP OAuth doc page (mcp_oauth.md) with M2M and PKCE sections
- Update FAQ in mcp.md to reflect M2M support
- Add E2E test script and config

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix mypy lint

* fix oauth2

* ui feat fixes

* test M2M

* test fix

* ui feats

* ui fixes

* ui fix client ID

* fix: backend endpoints

* docs fix

* fixes greptile

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

* [Fix] prevent shared backend model key from being polluted by per-deployment custom pricing (#20679)

* bug: custom price override for models

* added associated test

* fix(mcp): resolve OAuth2 root endpoints returning "MCP server not found" (#20784)

When MCP SDK hits root-level /register, /authorize, /token without
server name prefix, auto-resolve to the single configured OAuth2
server. Also fix WWW-Authenticate header to use correct public URL
behind reverse proxy.

* Add support for langchain_aws via litellm passthrough

* fix(proxy): return early instead of raising ValueError when standard_logging_payload is missing

The `_PROXY_VirtualKeyModelMaxBudgetLimiter.async_log_success_event` hook
raises `ValueError` when `standard_logging_payload` is `None`.  This breaks
non-standard call types (e.g. vLLM `/classify`) that do not populate the
payload, and the resulting exception disrupts downstream success callbacks
like Langfuse.

Return early with a debug log instead, matching the existing pattern used
for missing `user_api_key_model_max_budget`.

Fixes #18986

---------

Co-authored-by: Sameer Kankute <sameer@berri.ai>
Co-authored-by: yuneng-jiang <yuneng.jiang@gmail.com>
Co-authored-by: Ishaan Jaff <ishaanjaffer0324@gmail.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Shivam Rawat <161387515+shivamrawat1@users.noreply.github.com>
Co-authored-by: michelligabriele <gabriele.michelli@icloud.com>
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]: ValueError: standard_logging_payload is required while calling vLLM classify endpoint

7 participants