BerriAI/litellm · error · ValueError
prompt_id is required for Humanloop integration
Error message
prompt_id is required for Humanloop integration
What it means
ValueError from the Humanloop integration's get_chat_completion_prompt: Humanloop prompt resolution only works by id. If prompt_id is None the call cannot proceed. (If the API key is also missing the method delegates to the parent class instead, so this fires specifically when an id is absent.)
Source
Thrown at litellm/integrations/humanloop.py:161
messages: list[AllMessageValues],
non_default_params: dict,
prompt_id: str | None,
prompt_variables: dict | None,
dynamic_callback_params: StandardCallbackDynamicParams,
prompt_spec: PromptSpec | None = None,
prompt_label: str | None = None,
prompt_version: int | None = None,
ignore_prompt_manager_model: bool | None = False,
ignore_prompt_manager_optional_params: bool | None = False,
) -> tuple[
str,
list[AllMessageValues],
dict,
]:
humanloop_api_key = dynamic_callback_params.get("humanloop_api_key") or get_secret_str("HUMANLOOP_API_KEY")
if prompt_id is None:
raise ValueError("prompt_id is required for Humanloop integration")
if humanloop_api_key is None:
return super().get_chat_completion_prompt(
model=model,
messages=messages,
non_default_params=non_default_params,
prompt_id=prompt_id,
prompt_variables=prompt_variables,
dynamic_callback_params=dynamic_callback_params,
prompt_spec=prompt_spec,
)
prompt_template: Final = prompt_manager._get_prompt_from_id(
humanloop_prompt_id=prompt_id, humanloop_api_key=humanloop_api_key
)
updated_messages: Final = prompt_manager.compile_prompt(
prompt_template=prompt_template["prompt_template"],View on GitHub (pinned to 6c2dcb801b)
Solutions
- Pass prompt_id=<Humanloop prompt id> on the completion call
- Remove the Humanloop prompt callback if you intended plain completions
- Double-check that dynamic_callback_params route to the intended handler
Example fix
# before
response = litellm.completion(model='gpt-4o', messages=messages)
# after
response = litellm.completion(
model='gpt-4o',
messages=[{'role': 'user', 'content': 'hi'}],
prompt_id='your-humanloop-prompt-id',
prompt_variables={'name': 'A'},
) Defensive patterns
Strategy: validation
Validate before calling
if prompt_id is None:
raise ValueError("Humanloop integration requires prompt_id")
# only then call completion Type guard
def has_prompt_id(kwargs: dict) -> bool:
pid = kwargs.get("prompt_id")
return isinstance(pid, str) and len(pid) > 0 Prevention
- Always pass prompt_id with the Humanloop callback enabled
- Remove the callback for plain completions
When it happens
Trigger: Routing a completion through the Humanloop prompt handler without specifying prompt_id — relying on messages alone, or on prompt_spec, which Humanloop's integration does not support.
Common situations: litellm.callbacks includes the Humanloop prompt integration but the request meant to be a plain completion; migrating from another prompt manager that accepts names/spec objects; kwargs dropping prompt_id in a wrapper.
Related errors
- Invalid template message type: {type(template_message)}
- prompt_id is required for GitLab prompt manager
- Error getting prompt from Humanloop: {e.response.text}
- soft_budget cannot be negative. Received: {data.soft_budget}
- soft_budget ({data.soft_budget}) must be strictly lower than
AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15).
Data as JSON: /api/errors/b9b9ad34d663e32f.
Report an issue: GitHub.