BerriAI/litellm · error · HTTPException
litellm_params cannot be None
Error message
litellm_params cannot be None
What it means
Merge guard during prompt patching: after merging the request's litellm_params with the existing prompt's params the result is None, meaning no usable litellm_params exist to build the updated prompt spec; the merge is aborted before any write.
Source
Thrown at litellm/proxy/prompts/prompt_endpoints.py:1144
# Use existing prompt from memory or build from DB row for field merging
if existing_prompt:
current_litellm_params = existing_prompt.litellm_params
current_prompt_info = existing_prompt.prompt_info
else:
current_spec: Final = create_versioned_prompt_spec(db_prompt=target_row)
current_litellm_params = current_spec.litellm_params
current_prompt_info = current_spec.prompt_info
# Update fields if provided
updated_litellm_params: Final = (
request.litellm_params if request.litellm_params is not None else current_litellm_params
)
updated_prompt_info: Final = request.prompt_info if request.prompt_info is not None else current_prompt_info
# Ensure we have valid litellm_params
if updated_litellm_params is None:
raise HTTPException(status_code=400, detail="litellm_params cannot be None")
# Build update data dict
update_data: Final[dict[str, str]] = {
"litellm_params": updated_litellm_params.model_dump_json(),
"prompt_info": updated_prompt_info.model_dump_json(),
}
if user_api_key_dict.user_id:
update_data["created_by"] = user_api_key_dict.user_id
# Update by primary key (id) to target exactly one row
updated_prompt_db_entry: Final = await _prompt_table(prisma_client).update(
where={"id": target_row.id},
data=update_data,
)
updated_prompt_spec: Final = create_versioned_prompt_spec(db_prompt=updated_prompt_db_entry)
return _reload_prompt_in_registry(IN_MEMORY_PROMPT_REGISTRY, versioned_id, updated_prompt_spec)View on GitHub (pinned to 77b7c6c40c)
Solutions
- Provide a non-null litellm_params object in the prompt request payload.
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at litellm/proxy/prompts/prompt_endpoints.py:1144 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/a228100b54875d8e.
Report an issue: GitHub.