{"record":{"id":"d44ecf38d45adfdf","repo":"BerriAI/litellm","slug":"cannot-set-prompt-directory-when-working-with-prom","errorCode":null,"errorMessage":"Cannot set prompt_directory when working with prompt_initializer. Needs to be a specific dotprompt file","messagePattern":"Cannot set prompt_directory when working with prompt_initializer\\. Needs to be a specific dotprompt file","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/integrations/dotprompt/__init__.py","lineNumber":54,"sourceCode":"    from .prompt_manager import PromptManager\n\n    # Parse the dotprompt content to extract frontmatter and content\n    temp_manager: Final = PromptManager()\n    metadata, content = temp_manager._parse_frontmatter(dotprompt_content)\n\n    # Convert to prompt_data format\n    return {\"content\": content.strip(), \"metadata\": metadata}\n\n\ndef prompt_initializer(litellm_params: \"PromptLiteLLMParams\", prompt_spec: \"PromptSpec\") -> \"CustomPromptManagement\":\n    \"\"\"\n    Initialize a prompt from a .prompt file.\n    \"\"\"\n    prompt_directory: Final = getattr(litellm_params, \"prompt_directory\", None)\n    prompt_data = getattr(litellm_params, \"prompt_data\", None)\n    prompt_id: Final = getattr(litellm_params, \"prompt_id\", None)\n    if prompt_directory:\n        raise ValueError(\n            \"Cannot set prompt_directory when working with prompt_initializer. Needs to be a specific dotprompt file\"\n        )\n\n    prompt_file: Final = getattr(litellm_params, \"prompt_file\", None)\n\n    # Handle dotprompt_content from database\n    dotprompt_content: Final = getattr(litellm_params, \"dotprompt_content\", None)\n    if dotprompt_content and not prompt_data and not prompt_file:\n        prompt_data = _get_prompt_data_from_dotprompt_content(dotprompt_content)\n\n    try:\n        dot_prompt_manager: Final = DotpromptManager(\n            prompt_directory=prompt_directory,\n            prompt_data=prompt_data,\n            prompt_file=prompt_file,\n            prompt_id=prompt_id,\n        )\n","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/integrations/dotprompt/__init__.py#L36-L72","documentation":"Error \"Cannot set prompt_directory when working with prompt_initializer. Needs to be a specific dotprompt file\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/integrations/dotprompt/__init__.py:54 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Do not set prompt_directory when a prompt_initializer (specific dotprompt file) is configured; use one or the other."],"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-15T17:31:12.345Z"}