{"record":{"id":"05b546a9caf2d93b","repo":"BerriAI/litellm","slug":"cannot-delete-config-prompts","errorCode":null,"errorMessage":"Cannot delete config prompts.","messagePattern":"Cannot delete config prompts\\.","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"litellm/proxy/prompts/prompt_endpoints.py","lineNumber":988,"sourceCode":"    try:\n        # Try to get prompt directly first\n        existing_prompt = IN_MEMORY_PROMPT_REGISTRY.get_prompt_by_id(prompt_id)\n\n        # If not found, try to find the latest version\n        if existing_prompt is None:\n            latest_prompt_id: Final = get_latest_version_prompt_id(\n                prompt_id=prompt_id,\n                all_prompt_ids=IN_MEMORY_PROMPT_REGISTRY.IN_MEMORY_PROMPTS,\n            )\n            existing_prompt = IN_MEMORY_PROMPT_REGISTRY.get_prompt_by_id(latest_prompt_id)\n            # Use the resolved prompt_id for deletion\n            prompt_id = latest_prompt_id\n\n        if existing_prompt is None:\n            raise HTTPException(status_code=404, detail=f\"Prompt with ID {prompt_id} not found\")\n\n        if existing_prompt.prompt_info.prompt_type == \"config\":\n            raise HTTPException(\n                status_code=400,\n                detail=\"Cannot delete config prompts.\",\n            )\n\n        # Get the base prompt ID (without version suffix) for database deletion\n        base_prompt_id: Final = get_base_prompt_id(prompt_id=prompt_id)\n\n        # Build delete filter; scope to environment if provided\n        delete_where: Final[dict[str, str]] = {\"prompt_id\": base_prompt_id}\n        if environment:\n            delete_where[\"environment\"] = environment\n\n        # Delete versions from the database (scoped to environment if provided)\n        await _prompt_table(prisma_client).delete_many(where=delete_where)\n\n        # Remove matching prompts from memory — scope to environment if provided\n        if environment:\n            prompts_to_delete: Final = [","sourceCodeStart":970,"sourceCodeEnd":1006,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/prompts/prompt_endpoints.py#L970-L1006","documentation":"Mutation guard on prompt deletion: the prompt exists but is defined in the proxy config file, not the database. Deleting it via the API would be overwritten on the next config reload, so deletion is refused; edit the config file instead.","triggerScenarios":"Thrown at litellm/proxy/prompts/prompt_endpoints.py:988 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove the prompt from config.yaml and restart instead of deleting via the API; config prompts cannot be deleted at runtime."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}