BerriAI/litellm · error · ValueError

prompt_id is required for Humanloop integration

Error message

prompt_id is required for Humanloop integration

What it means

Guard in the Humanloop prompt-management callback: prompt_id is None, but the Humanloop integration requires a prompt_id to look up which prompt template to apply to the messages.

Solutions

  1. Pass prompt_id in the request when using the Humanloop integration.

Example fix

litellm.completion(model='gpt-4', prompt_id='hl_prompt_id', messages=[{'role':'user','content':'hi'}])
Defensive patterns

Strategy: validation

When it happens

Trigger: Calling the Humanloop prompt integration without a prompt_id.

Common situations: prompt_id omitted from the request or lost when forwarding metadata.


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/b9b9ad34d663e32f. Report an issue: GitHub.

Appendix: 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 77b7c6c40c)