{"record":{"id":"dceec433bf192792","repo":"BerriAI/litellm","slug":"failed-to-mark-migration-name-as-applied-after-i","errorCode":null,"errorMessage":"Failed to mark migration {name} as applied after idempotent recovery. Manual intervention may be required.\n\nDetail: {resolve_err}","messagePattern":"Failed to mark migration (.+?) as applied after idempotent recovery\\. Manual intervention may be required\\.\n\nDetail: (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"litellm-proxy-extras/litellm_proxy_extras/utils.py","lineNumber":616,"sourceCode":"                            try:\n                                ProxyExtrasDBManager._roll_back_migration(name)\n                            except (\n                                subprocess.CalledProcessError,\n                                subprocess.TimeoutExpired,\n                            ):\n                                pass  # may already be rolled-back\n                            try:\n                                ProxyExtrasDBManager._resolve_specific_migration(name)\n                            except (\n                                subprocess.CalledProcessError,\n                                subprocess.TimeoutExpired,\n                            ) as resolve_err:\n                                # We're already inside the outer\n                                # `except CalledProcessError` handler —\n                                # re-raising CalledProcessError from here\n                                # would escape as itself, bypassing\n                                # proxy_cli.py's `except RuntimeError`.\n                                raise RuntimeError(\n                                    f\"Failed to mark migration {name} as applied \"\n                                    f\"after idempotent recovery. Manual \"\n                                    f\"intervention may be required.\\n\\n\"\n                                    f\"Detail: {resolve_err}\"\n                                ) from resolve_err\n                            continue\n                        raise RuntimeError(\n                            \"Database migration failed and cannot be auto-recovered. \"\n                            f\"Manual intervention required.\\n\\nPrisma error:\\n{stderr}\"\n                        ) from e\n\n                    if \"P3018\" in stderr:\n                        if ProxyExtrasDBManager._is_permission_error(stderr):\n                            raise RuntimeError(\n                                \"Database migration failed due to insufficient \"\n                                \"permissions. Please grant the required privileges \"\n                                f\"and retry.\\n\\nPrisma error:\\n{stderr}\"\n                            ) from e","sourceCodeStart":598,"sourceCodeEnd":634,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm-proxy-extras/litellm_proxy_extras/utils.py#L598-L634","documentation":"RuntimeError raised after an idempotent migration was re-resolved successfully but marking it as applied in the _prisma_migrations ledger failed ('prisma migrate resolve' errored). The migration system state is now inconsistent and needs manual fixing.","triggerScenarios":"Thrown at litellm-proxy-extras/litellm_proxy_extras/utils.py:616 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Manually run 'prisma migrate resolve --applied {name}' against the database to fix the migrations ledger.","Inspect {resolve_err} for why the ledger update failed."],"exampleFix":null,"handlingStrategy":"try-catch","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"}