BerriAI/litellm · error · HTTPException
Prompt with ID {base_prompt_id} not found in environment {en
Error message
Prompt with ID {base_prompt_id} not found in environment {env} What it means
Patch guard: after resolving the base prompt ID, environment, and optional version, the composite lookup (prompt_id + environment [+ version]) on the prompt table returned no rows, so there is no matching version in that environment to patch.
Source
Thrown at litellm/proxy/prompts/prompt_endpoints.py:1109
base_prompt_id: Final = get_base_prompt_id(prompt_id=prompt_id)
env: Final = environment or "development"
requested_version: Final = get_version_number(prompt_id=prompt_id) if prompt_id != base_prompt_id else None
# Build query to find the exact row by composite unique key
find_where: Final[dict[str, str | int]] = {
"prompt_id": base_prompt_id,
"environment": env,
}
if requested_version is not None:
find_where["version"] = requested_version
db_rows: Final = await _prompt_table(prisma_client).find_many(
where=find_where,
order={"version": "desc"},
take=1,
)
if not db_rows:
raise HTTPException(
status_code=404,
detail=f"Prompt with ID {base_prompt_id} not found in environment {env}",
)
target_row: Final = db_rows[0]
# Check if prompt exists in memory
versioned_id: Final = f"{base_prompt_id}.v{target_row.version}"
existing_prompt: Final = IN_MEMORY_PROMPT_REGISTRY.get_prompt_by_id(versioned_id)
if existing_prompt and existing_prompt.prompt_info.prompt_type == "config":
raise HTTPException(
status_code=400,
detail="Cannot update config prompts.",
)
# Use existing prompt from memory or build from DB row for field merging
if existing_prompt:View on GitHub (pinned to 77b7c6c40c)
Solutions
- Verify the prompt exists in the specified environment; create or promote it to that environment first.
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at litellm/proxy/prompts/prompt_endpoints.py:1109 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/6e000011499de421.
Report an issue: GitHub.