{"record":{"id":"1d7b7bd2e76d8b97","repo":"BerriAI/litellm","slug":"prompt-id-is-required-when-prompt-file-is-provided","errorCode":null,"errorMessage":"prompt_id is required when prompt_file is provided","messagePattern":"prompt_id is required when prompt_file is provided","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/integrations/dotprompt/prompt_manager.py","lineNumber":84,"sourceCode":"        self.jinja_env = ImmutableSandboxedEnvironment(\n            loader=DictLoader({}),\n            autoescape=select_autoescape([\"html\", \"xml\"]),\n            # Use Handlebars-style delimiters to match Dotprompt spec\n            variable_start_string=\"{{\",\n            variable_end_string=\"}}\",\n            block_start_string=\"{%\",\n            block_end_string=\"%}\",\n            comment_start_string=\"{#\",\n            comment_end_string=\"#}\",\n        )\n\n        # Load prompts from directory if provided\n        if self.prompt_directory:\n            self._load_prompts()\n\n        if self.prompt_file:\n            if not prompt_id:\n                raise ValueError(\"prompt_id is required when prompt_file is provided\")\n\n            template: Final = self._load_prompt_file(self.prompt_file, prompt_id)\n            self.prompts[prompt_id] = template\n\n        # Load prompts from JSON data if provided\n        if prompt_data:\n            self._load_prompts_from_json(prompt_data, prompt_id)\n\n    def _load_prompts(self) -> None:\n        \"\"\"Load all .prompt files from the prompt directory.\"\"\"\n        if not self.prompt_directory or not self.prompt_directory.exists():\n            raise ValueError(f\"Prompt directory does not exist: {self.prompt_directory}\")\n\n        prompt_files: Final = list(self.prompt_directory.glob(\"*.prompt\"))\n\n        for prompt_file in prompt_files:\n            try:\n                prompt_id = prompt_file.stem  # filename without extension","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/integrations/dotprompt/prompt_manager.py#L66-L102","documentation":"Error \"prompt_id is required when prompt_file is provided\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/integrations/dotprompt/prompt_manager.py:84 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass prompt_id together with prompt_file."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}