Skip to content

Fix: Extra inputs are not permitted, field: 'messages[2].provider_specific_fields - #20334

Merged
Sameerlite merged 1 commit into
mainfrom
litellm_fireworks_ai_field_remoal
Feb 4, 2026
Merged

Fix: Extra inputs are not permitted, field: 'messages[2].provider_specific_fields#20334
Sameerlite merged 1 commit into
mainfrom
litellm_fireworks_ai_field_remoal

Conversation

@Sameerlite

@Sameerlite Sameerlite commented Feb 3, 2026

Copy link
Copy Markdown
Contributor

Relevant issues

Fireworks doesn't like messages[2].provider_specific_fields in its request and throws an error. This Pr removes this field. The transform response doesn't add any provider_specific_fields in the response, so this means that some other LLMs provider_specific_fields from history had gotten added

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

🆕 New Feature
🐛 Bug Fix
🧹 Refactoring
📖 Documentation
🚄 Infrastructure
✅ Test

Changes

image

@vercel

vercel Bot commented Feb 3, 2026

Copy link
Copy Markdown

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

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

Request Review

@greptile-apps

greptile-apps Bot commented Feb 3, 2026

Copy link
Copy Markdown
Contributor

Greptile Overview

Greptile Summary

Fixed FireworksAI API compatibility by removing provider_specific_fields from messages before sending requests. This field caused API errors with the message "Extra inputs are not permitted, field: 'messages[n].provider_specific_fields'".

Changes:

  • Added field removal in _transform_messages_helper (transformation.py:239-242) after existing cache_control filtering
  • Uses safe message.pop("provider_specific_fields", None) with type check to prevent KeyError
  • Follows established pattern similar to cache_control filtering on line 238
  • Added comprehensive test coverage with 3 test cases (with field, without field, mixed)

Impact:

  • Prevents API errors when provider_specific_fields is present in messages
  • No breaking changes - only removes unsupported field before API call
  • Maintains all other message properties intact

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • Score reflects a well-implemented bug fix with proper testing. The change is minimal, follows established patterns in the codebase, includes comprehensive test coverage, and has no breaking changes or performance implications
  • No files require special attention

Important Files Changed

Filename Overview
litellm/llms/fireworks_ai/chat/transformation.py Added provider_specific_fields filtering to prevent FireworksAI API errors - clean implementation
tests/test_litellm/llms/fireworks_ai/chat/test_fireworks_ai_chat_transformation.py Added comprehensive test coverage for provider_specific_fields removal functionality

Sequence Diagram

sequenceDiagram
    participant Client
    participant LiteLLM
    participant FireworksAIConfig
    participant FireworksAI API

    Client->>LiteLLM: chat completion request with messages
    LiteLLM->>FireworksAIConfig: transform_request(messages)
    FireworksAIConfig->>FireworksAIConfig: _transform_messages_helper(messages)
    
    Note over FireworksAIConfig: Loop through each message
    FireworksAIConfig->>FireworksAIConfig: filter_value_from_dict(message, "cache_control")
    FireworksAIConfig->>FireworksAIConfig: Check if "provider_specific_fields" exists
    
    alt provider_specific_fields exists
        FireworksAIConfig->>FireworksAIConfig: message.pop("provider_specific_fields", None)
        Note over FireworksAIConfig: Removes field to prevent API error
    end
    
    FireworksAIConfig-->>LiteLLM: cleaned messages
    LiteLLM->>FireworksAI API: API request (without provider_specific_fields)
    FireworksAI API-->>LiteLLM: successful response
    LiteLLM-->>Client: completion response
Loading

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

2 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@Sameerlite
Sameerlite merged commit f11c16a into main Feb 4, 2026
53 of 65 checks passed
@ishaan-berri
ishaan-berri deleted the litellm_fireworks_ai_field_remoal branch March 26, 2026 22:29
fzowl pushed a commit to fzowl/litellm that referenced this pull request Jun 24, 2026
…eld_remoal

Fix: Extra inputs are not permitted, field: 'messages[2].provider_specific_fields
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.

1 participant