{"record":{"id":"6e000011499de421","repo":"BerriAI/litellm","slug":"prompt-with-id-base-prompt-id-not-found-in-envir","errorCode":null,"errorMessage":"Prompt with ID {base_prompt_id} not found in environment {env}","messagePattern":"Prompt with ID (.+?) not found in environment (.+?)","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"error","filePath":"litellm/proxy/prompts/prompt_endpoints.py","lineNumber":1109,"sourceCode":"        base_prompt_id: Final = get_base_prompt_id(prompt_id=prompt_id)\n        env: Final = environment or \"development\"\n        requested_version: Final = get_version_number(prompt_id=prompt_id) if prompt_id != base_prompt_id else None\n\n        # Build query to find the exact row by composite unique key\n        find_where: Final[dict[str, str | int]] = {\n            \"prompt_id\": base_prompt_id,\n            \"environment\": env,\n        }\n        if requested_version is not None:\n            find_where[\"version\"] = requested_version\n\n        db_rows: Final = await _prompt_table(prisma_client).find_many(\n            where=find_where,\n            order={\"version\": \"desc\"},\n            take=1,\n        )\n        if not db_rows:\n            raise HTTPException(\n                status_code=404,\n                detail=f\"Prompt with ID {base_prompt_id} not found in environment {env}\",\n            )\n\n        target_row: Final = db_rows[0]\n\n        # Check if prompt exists in memory\n        versioned_id: Final = f\"{base_prompt_id}.v{target_row.version}\"\n        existing_prompt: Final = IN_MEMORY_PROMPT_REGISTRY.get_prompt_by_id(versioned_id)\n\n        if existing_prompt and existing_prompt.prompt_info.prompt_type == \"config\":\n            raise HTTPException(\n                status_code=400,\n                detail=\"Cannot update config prompts.\",\n            )\n\n        # Use existing prompt from memory or build from DB row for field merging\n        if existing_prompt:","sourceCodeStart":1091,"sourceCodeEnd":1127,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/prompts/prompt_endpoints.py#L1091-L1127","documentation":"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.","triggerScenarios":"Thrown at litellm/proxy/prompts/prompt_endpoints.py:1109 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the prompt exists in the specified environment; create or promote it to that environment first."],"exampleFix":null,"handlingStrategy":"type-guard","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-14T00:17:10.932Z"}