{"record":{"id":"b6b3578080f8ebac","repo":"BerriAI/litellm","slug":"only-proxy-admins-can-update-prompts","errorCode":null,"errorMessage":"Only proxy admins can update prompts","messagePattern":"Only proxy admins can update prompts","errorType":"http","errorClass":"HTTPException","httpStatus":403,"severity":"error","filePath":"litellm/proxy/prompts/prompt_endpoints.py","lineNumber":855,"sourceCode":"                    \"prompt_integration\": \"dotprompt\",\n                    \"prompt_directory\": \"/path/to/prompts\"\n                },\n                \"prompt_info\": {\n                    \"prompt_type\": \"config\"\n                }\n            }\n        }'\n    ```\n    \"\"\"\n    from litellm.proxy.prompts.prompt_registry import IN_MEMORY_PROMPT_REGISTRY\n    from litellm.proxy.proxy_server import prisma_client\n\n    # Only allow proxy admins to update prompts\n    if user_api_key_dict.user_role is None or (\n        user_api_key_dict.user_role != LitellmUserRoles.PROXY_ADMIN\n        and user_api_key_dict.user_role != LitellmUserRoles.PROXY_ADMIN.value\n    ):\n        raise HTTPException(status_code=403, detail=\"Only proxy admins can update prompts\")\n\n    if prisma_client is None:\n        raise HTTPException(status_code=500, detail=CommonProxyErrors.db_not_connected_error.value)\n\n    try:\n        # Strip version suffix from prompt_id if present (e.g., \"jack_success.v1\" -> \"jack_success\")\n        base_prompt_id: Final = get_base_prompt_id(prompt_id=prompt_id)\n\n        # Extract environment from request\n        environment: Final = (\n            request.prompt_info.environment\n            if request.prompt_info and request.prompt_info.environment\n            else \"development\"\n        )\n\n        # Check if any version of this prompt exists (in any environment)\n        existing_prompts = await _prompt_table(prisma_client).find_many(where={\"prompt_id\": base_prompt_id})\n","sourceCodeStart":837,"sourceCodeEnd":873,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/prompts/prompt_endpoints.py#L837-L873","documentation":"Authorization gate on prompt update: the caller's user_api_key_dict lacks the PROXY_ADMIN role, so the update is refused before the prompt is looked up or modified.","triggerScenarios":"Thrown at litellm/proxy/prompts/prompt_endpoints.py:855 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a proxy admin key to update prompts."],"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"}