{"record":{"id":"1c53ee49a70ffd5f","repo":"BerriAI/litellm","slug":"migration-failed-due-to-permission-error-migratio","errorCode":null,"errorMessage":"Migration failed due to permission error. Migration {migration_name} was NOT applied. Please grant necessary database permissions and retry.","messagePattern":"Migration failed due to permission error\\. Migration (.+?) was NOT applied\\. Please grant necessary database permissions and retry\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"litellm-proxy-extras/litellm_proxy_extras/utils.py","lineNumber":909,"sourceCode":"                                    f\"Please check database user privileges. Error: {e.stderr}\"\n                                )\n\n                                # Mark as rolled back and exit with error\n                                if migration_match:\n                                    try:\n                                        ProxyExtrasDBManager._roll_back_migration(\n                                            migration_name\n                                        )\n                                        logger.info(\n                                            f\"Migration {migration_name} marked as rolled back\"\n                                        )\n                                    except Exception as rollback_error:\n                                        logger.warning(\n                                            f\"Failed to mark migration as rolled back: {rollback_error}\"\n                                        )\n\n                                # Re-raise the error to prevent silent failures\n                                raise RuntimeError(\n                                    f\"Migration failed due to permission error. Migration {migration_name} \"\n                                    f\"was NOT applied. Please grant necessary database permissions and retry.\"\n                                ) from e\n\n                            elif ProxyExtrasDBManager._is_idempotent_error(e.stderr):\n                                # Idempotent errors mean the migration has effectively been applied\n                                logger.info(\n                                    \"Migration failed due to idempotent error (e.g., column already exists), \"\n                                    \"resolving as applied\"\n                                )\n                                # Extract the migration name from the error message\n                                migration_match = re.search(\n                                    r\"Migration name: (\\d+_.*)\", e.stderr\n                                )\n                                if migration_match:\n                                    migration_name = migration_match.group(1)\n                                    try:\n                                        logger.info(","sourceCodeStart":891,"sourceCodeEnd":927,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm-proxy-extras/litellm_proxy_extras/utils.py#L891-L927","documentation":"Error \"Migration failed due to permission error. Migration {migration_name} was NOT applied. Please grant necessary database permissions and retry.\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm-proxy-extras/litellm_proxy_extras/utils.py:909 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Grant the necessary database permissions, then rerun the migration so {migration_name} is applied.","Mark state correctly afterward with prisma migrate resolve if partially applied."],"exampleFix":null,"handlingStrategy":null,"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"}