BerriAI/litellm · error · ValueError

Prompt directory does not exist: {self.prompt_directory}

Error message

Prompt directory does not exist: {self.prompt_directory}

What it means

Error "Prompt directory does not exist: {self.prompt_directory}" thrown in BerriAI/litellm.

Source

Thrown at litellm/integrations/dotprompt/prompt_manager.py:96

        # 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 extension
                template = self._load_prompt_file(prompt_file, prompt_id)
                self.prompts[prompt_id] = template
                # Optional: print(f"Loaded prompt: {prompt_id}")
            except Exception:
                # Optional: print(f"Error loading prompt file {prompt_file}")
                pass

    def _load_prompts_from_json(self, prompt_data: dict[str, dict[str, Any]], prompt_id: str | None = None) -> None:
        """Load prompts from JSON data structure.

        Expected format:
        {

View on GitHub (pinned to 6c2dcb801b)

Solutions

  1. Create the prompt directory or correct the prompt_directory path.

When it happens

Trigger: Thrown at litellm/integrations/dotprompt/prompt_manager.py:96 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/02a2710ece4c2416. Report an issue: GitHub.