{"record":{"id":"80ca232b38dbb802","repo":"BerriAI/litellm","slug":"prompt-id-or-prompt-spec-is-required","errorCode":null,"errorMessage":"prompt_id or prompt_spec is required","messagePattern":"prompt_id or prompt_spec is required","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/integrations/generic_prompt_management/generic_prompt_manager.py","lineNumber":109,"sourceCode":"        if self.api_key:\n            headers[\"Authorization\"] = f\"Bearer {self.api_key}\"\n        return headers\n\n    def _fetch_prompt_from_api(self, prompt_id: str | None, prompt_spec: PromptSpec | None) -> dict[str, Any]:\n        \"\"\"\n        Fetch a prompt from the API.\n\n        Args:\n            prompt_id: The ID of the prompt to fetch\n\n        Returns:\n            The prompt data from the API\n\n        Raises:\n            Exception: If the API request fails\n        \"\"\"\n        if prompt_id is None and prompt_spec is None:\n            raise ValueError(\"prompt_id or prompt_spec is required\")\n\n        url: Final = f\"{self.api_base}/beta/litellm_prompt_management\"\n        params: Final = {\n            \"prompt_id\": prompt_id,\n            **(self.additional_provider_specific_query_params or {}),\n        }\n        http_client: Final = _get_httpx_client()\n\n        try:\n            response: Final = http_client.get(\n                url,\n                params=params,\n                headers=self._get_headers(),\n            )\n\n            response.raise_for_status()\n            return response.json()\n        except httpx.HTTPError as e:","sourceCodeStart":91,"sourceCodeEnd":127,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/integrations/generic_prompt_management/generic_prompt_manager.py#L91-L127","documentation":"Raised by GenericPromptManager._fetch_prompt_from_api (sync path) when both prompt_id and prompt_spec are None. The manager needs at least one identifier to know which prompt to request from the /beta/litellm_prompt_management endpoint.","triggerScenarios":"Calling compile_prompt_helper(prompt_id=None, prompt_spec=None); configuring a prompt-management model whose litellm_params has neither prompt_id nor a prompt_spec; a PromptSpec object that fails to carry a prompt_id through to the fetch call.","commonSituations":"Omitting 'prompt_id' in the model's litellm_params in config.yaml; passing a model_info block for prompt integration but leaving the identifier fields empty during initial setup or after renaming the field.","solutions":["Set prompt_id in the model's litellm_params (e.g. prompt_id: my-prompt-id) so the prompt can be resolved.","Alternatively supply a complete PromptSpec (with its own litellm_params including prompt_id) so prompt_spec is not None.","Verify you are not shadowing the value: a prompt_id set on the wrong nesting level (e.g. under model_info instead of litellm_params) reads as None."],"exampleFix":"// before\nlitellm_params:\n  model: openai/gpt-4o\n  prompt_integration: generic_api\n  api_base: https://proxy.example.com\n  // prompt_id missing\n\n// after\nlitellm_params:\n  model: openai/gpt-4o\n  prompt_integration: generic_api\n  api_base: https://proxy.example.com\n  prompt_id: my-prompt-id","handlingStrategy":"validation","validationCode":"def validate_prompt_identifier(prompt_id: str | None, prompt_spec) -> None:\n    if prompt_id is None and prompt_spec is None:\n        raise ValueError(\"Configure prompt_id (or a full prompt_spec) on the prompt-management model\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Assert every prompt-integration model in config defines prompt_id or prompt_spec before serving traffic.","Lint config.yaml for models with prompt_integration but no identifier keys.","Log the resolved prompt_id at startup so a None value is visible immediately."],"tags":["prompt-management","validation","missing-argument"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}