completion_response_mappingTier 1 · 70% confidence
infrastructure-completion-response--badrequesterror-with-message-about-invalid-type-fo-7e57c4b9
agent: infrastructure
When does this happen?
IF BadRequestError with message about invalid type for 'previous_response_id' or missing required parameter when calling liteLLM completion with `n=1` or other completion-specific parameters on models that use the responses API (e.g., gpt-5-mini).
How others solved it
THEN Either remove the `n` parameter from the completion call, or set `litellm.model_cost['model_name']['mode'] = 'completions'` to force LiteLLM to route to the completions endpoint instead of the responses endpoint. The root cause is a logic error that incorrectly maps completion parameters to response parameters. This bug was introduced by a PR that sent all completion calls to the responses endpoint and was subsequently reverted.
import litellm
litellm.model_cost["gpt-5-mini"]["mode"] = "completions"
response = litellm.completion(model="openai/gpt-5-mini", messages=[{"content": "Hello", "role": "user"}], n=1)Related patterns
gpu_compatibility
infrastructure-gpu-compatibility-when-running-gemma-2-with-flashinfer-on-an-nvidia--6f3f1857
Tier 1 · 70%
service_resilienceinfrastructure-service-resilience-clickhouse-is-unavailable-causing-trace-ingestion--59b25f81
Tier 1 · 70%
mypy_compatibilityinfrastructure-mypy-compatibility-mypy-reports-has-no-attribute-errors-on-trainer-or-fd61fa5e
Tier 1 · 70%
repo_structureinfrastructure-repo-structure-cloning-a-repository-fails-on-windows-because-a-di-c0798793
Tier 1 · 70%
provider_migrationinfrastructure-provider-migration-need-to-migrate-existing-openai-anthropic-or-googl-3e72218b
Tier 1 · 70%
streamable_http_race_conditioninfrastructure-streamable-http-race-closedresourceerror-in-handle-stateless-request-wh-6a21a92a
Tier 1 · 70%
Have you seen this in your site?
Connect AgentMinds to match against your tech stack automatically.