BerriAI/litellm · error · ValueError
prompt_id is required when prompt_file is provided
Error message
prompt_id is required when prompt_file is provided
What it means
Error "prompt_id is required when prompt_file is provided" thrown in BerriAI/litellm.
Source
Thrown at litellm/integrations/dotprompt/prompt_manager.py:84
self.jinja_env = ImmutableSandboxedEnvironment(
loader=DictLoader({}),
autoescape=select_autoescape(["html", "xml"]),
# Use Handlebars-style delimiters to match Dotprompt spec
variable_start_string="{{",
variable_end_string="}}",
block_start_string="{%",
block_end_string="%}",
comment_start_string="{#",
comment_end_string="#}",
)
# Load prompts from directory if provided
if self.prompt_directory:
self._load_prompts()
if self.prompt_file:
if not prompt_id:
raise ValueError("prompt_id is required when prompt_file is provided")
template: Final = self._load_prompt_file(self.prompt_file, prompt_id)
self.prompts[prompt_id] = template
# Load prompts from JSON data if provided
if prompt_data:
self._load_prompts_from_json(prompt_data, prompt_id)
def _load_prompts(self) -> None:
"""Load all .prompt files from the prompt directory."""
if not self.prompt_directory or not self.prompt_directory.exists():
raise ValueError(f"Prompt directory does not exist: {self.prompt_directory}")
prompt_files: Final = list(self.prompt_directory.glob("*.prompt"))
for prompt_file in prompt_files:
try:
prompt_id = prompt_file.stem # filename without extensionView on GitHub (pinned to 6c2dcb801b)
Solutions
- Pass prompt_id together with prompt_file.
When it happens
Trigger: Thrown at litellm/integrations/dotprompt/prompt_manager.py:84 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15).
Data as JSON: /api/errors/1d7b7bd2e76d8b97.
Report an issue: GitHub.