BerriAI/litellm · error · HTTPException

Cannot update config prompts.

Error message

Cannot update config prompts.

What it means

Mutation guard on prompt update: the target prompt exists, but it originates from the proxy config file (prompt_type 'config') rather than the database. Config-defined prompts are read-only via the API because the config file is the source of truth.

Source

Thrown at litellm/proxy/prompts/prompt_endpoints.py:883

        environment: Final = (
            request.prompt_info.environment
            if request.prompt_info and request.prompt_info.environment
            else "development"
        )

        # Check if any version of this prompt exists (in any environment)
        existing_prompts = await _prompt_table(prisma_client).find_many(where={"prompt_id": base_prompt_id})

        if not existing_prompts:
            raise HTTPException(
                status_code=404,
                detail=f"Prompt with ID {base_prompt_id} not found",
            )

        # Check if it's a config prompt
        existing_in_memory: Final = IN_MEMORY_PROMPT_REGISTRY.get_prompt_by_id(prompt_id)
        if existing_in_memory and existing_in_memory.prompt_info.prompt_type == "config":
            raise HTTPException(
                status_code=400,
                detail="Cannot update config prompts.",
            )

        # Get next version number (UPDATE creates a new version)
        new_version: Final = await get_next_version_for_prompt(
            prisma_client=prisma_client,
            prompt_id=base_prompt_id,
            environment=environment,
        )

        # Store new version in db
        prompt_db_entry: Final = await _prompt_table(prisma_client).create(
            data={
                "prompt_id": base_prompt_id,
                "version": new_version,
                "environment": environment,
                "created_by": user_api_key_dict.user_id,

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Config-defined prompts are immutable at runtime; edit the prompt in config.yaml and restart, or create a DB prompt instead.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/proxy/prompts/prompt_endpoints.py:883 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/e229624bc52e34b5. Report an issue: GitHub.