{"record":{"id":"71f36abda425f246","repo":"BerriAI/litellm","slug":"prompt-id-is-required-for-prompt-management-base-c","errorCode":null,"errorMessage":"prompt_id is required for Prompt Management Base class","messagePattern":"prompt_id is required for Prompt Management Base class","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/integrations/prompt_management_base.py","lineNumber":168,"sourceCode":"\n        return model, completed_messages, updated_non_default_params\n\n    def get_chat_completion_prompt(\n        self,\n        model: str,\n        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[str, list[AllMessageValues], dict]:\n        if prompt_id is None:\n            raise ValueError(\"prompt_id is required for Prompt Management Base class\")\n        if not self.should_run_prompt_management(\n            prompt_id=prompt_id,\n            prompt_spec=prompt_spec,\n            dynamic_callback_params=dynamic_callback_params,\n        ):\n            return model, messages, non_default_params\n\n        prompt_template: Final = self.compile_prompt(\n            prompt_id=prompt_id,\n            prompt_variables=prompt_variables,\n            client_messages=messages,\n            dynamic_callback_params=dynamic_callback_params,\n            prompt_label=prompt_label,\n            prompt_version=prompt_version,\n        )\n\n        return self.post_compile_prompt_processing(\n            prompt_template=prompt_template,","sourceCodeStart":150,"sourceCodeEnd":186,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/integrations/prompt_management_base.py#L150-L186","documentation":"The prompt-management base requires an explicit prompt id: the wrapper that injects managed prompts into a completion raises ValueError('prompt_id is required for Prompt Management Base class') when prompt_id is None. It fires when a prompt-management integration callback is active for a call that did not specify prompt_id — the callback cannot know which prompt to compile.","triggerScenarios":"Registering a prompt integration globally (litellm.callbacks, proxy litellm_settings callbacks) so every completion routes through prompt management, then issuing a plain litellm.completion(...)/acompletion(...) without prompt_id; mixed traffic where only some calls use managed prompts.","commonSituations":"Adding 'humanlike'/'langfuse'/prompt-layer style callback for one feature and breaking every other call in the service; proxy-wide callback config vs per-request prompt usage.","solutions":["Pass prompt_id (and prompt_variables) on every call that should use managed prompts","Scope the prompt integration to per-request callbacks instead of global registration so only intended calls are intercepted","Or drop the prompt-management callback if it was enabled accidentally"],"exampleFix":"# before\nlitellm.callbacks = ['langfuse']  # prompt integration registered globally\nresp = litellm.completion(model='gpt-4o', messages=msgs)  # ValueError: prompt_id is required\n\n# after\n# only attach the prompt integration to calls that use it:\nresp = litellm.completion(model='gpt-4o', messages=msgs)  # no global prompt callback\nresp2 = litellm.completion(model='gpt-4o', messages=msgs, prompt_id='my-prompt', prompt_variables={'q': 'hi'})","handlingStrategy":"validation","validationCode":"if prompt_integration_active(litellm.callbacks) and prompt_id is None:\n    raise ValueError('prompt_id is required when a prompt-management integration is registered')\nresp = litellm.completion(model=model, messages=messages)","typeGuard":null,"tryCatchPattern":"try:\n    resp = litellm.completion(model=model, messages=messages)\nexcept ValueError as e:\n    if 'prompt_id is required' in str(e):\n        logger.error('prompt integration registered but call lacks prompt_id')\n    raise","preventionTips":["Attach prompt-management integrations per request instead of globally when only some calls use prompts","Assert prompt_id/prompt_variables presence in your wrapper before calling litellm","Document which routes expect managed prompts so config and call sites stay in sync"],"tags":["prompt-management","missing-parameter","callback","configuration"],"backgroundTag":"missing-required-argument","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}