{"record":{"id":"b9b9ad34d663e32f","repo":"BerriAI/litellm","slug":"prompt-id-is-required-for-humanloop-integration","errorCode":null,"errorMessage":"prompt_id is required for Humanloop integration","messagePattern":"prompt_id is required for Humanloop integration","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/integrations/humanloop.py","lineNumber":161,"sourceCode":"        messages: list[AllMessageValues],\n        non_default_params: dict,\n        prompt_id: str | None,\n        prompt_variables: dict | None,\n        dynamic_callback_params: StandardCallbackDynamicParams,\n        prompt_spec: PromptSpec | None = None,\n        prompt_label: str | None = None,\n        prompt_version: int | None = None,\n        ignore_prompt_manager_model: bool | None = False,\n        ignore_prompt_manager_optional_params: bool | None = False,\n    ) -> tuple[\n        str,\n        list[AllMessageValues],\n        dict,\n    ]:\n        humanloop_api_key = dynamic_callback_params.get(\"humanloop_api_key\") or get_secret_str(\"HUMANLOOP_API_KEY\")\n\n        if prompt_id is None:\n            raise ValueError(\"prompt_id is required for Humanloop integration\")\n\n        if humanloop_api_key is None:\n            return super().get_chat_completion_prompt(\n                model=model,\n                messages=messages,\n                non_default_params=non_default_params,\n                prompt_id=prompt_id,\n                prompt_variables=prompt_variables,\n                dynamic_callback_params=dynamic_callback_params,\n                prompt_spec=prompt_spec,\n            )\n\n        prompt_template: Final = prompt_manager._get_prompt_from_id(\n            humanloop_prompt_id=prompt_id, humanloop_api_key=humanloop_api_key\n        )\n\n        updated_messages: Final = prompt_manager.compile_prompt(\n            prompt_template=prompt_template[\"prompt_template\"],","sourceCodeStart":143,"sourceCodeEnd":179,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/integrations/humanloop.py#L143-L179","documentation":"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.)","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"# before\nresponse = litellm.completion(model='gpt-4o', messages=messages)\n\n# after\nresponse = litellm.completion(\n    model='gpt-4o',\n    messages=[{'role': 'user', 'content': 'hi'}],\n    prompt_id='your-humanloop-prompt-id',\n    prompt_variables={'name': 'A'},\n)","handlingStrategy":"validation","validationCode":"if prompt_id is None:\n    raise ValueError(\"Humanloop integration requires prompt_id\")\n# only then call completion","typeGuard":"def has_prompt_id(kwargs: dict) -> bool:\n    pid = kwargs.get(\"prompt_id\")\n    return isinstance(pid, str) and len(pid) > 0","tryCatchPattern":null,"preventionTips":["Always pass prompt_id with the Humanloop callback enabled","Remove the callback for plain completions"],"tags":["humanloop","prompt-management","litellm","validation"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}