java.lang.IllegalStateException: A migration from 1 to 2 was required but not found. Please provide the necessary Migration path
The Room schema version increased but no migration describes how to upgrade existing data.
A migration from 1 to 2 was required but not foundRoom migration required but not foundPlease provide the necessary Migration pathjava.lang.IllegalStateException: A migration from 1 to 2 was required but not found. Please provide the necessary Migration path via RoomDatabase.Builder.addMigration(Migration ...) Meaning
Provide a Migration(1, 2) (or use auto-migrations) or use fallbackToDestructiveMigration() during development. Always bump the version and export schemas.
Common causes
- Version bumped without a Migration
- Migration list not added to builder
- Wrong version pair
⚡ Quick fix
- Add Migration(1,2) with ALTER TABLE
- Use @AutoMigration
- Dev only: fallbackToDestructiveMigration
Detailed fix by platform
Kotlin
val M12 = object : Migration(1, 2) { override fun migrate(db: SupportSQLiteDatabase) { db.execSQL("ALTER TABLE user ADD COLUMN age INTEGER NOT NULL DEFAULT 0") } }
How to diagnose
- Versions — from/to?
- Builder — addMigrations?
- Schema — exported?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- App crashes after restore on a new phone (behavior) crash on first launch after device transfer / Auto Backup
- Cannot access database on the main thread Room: Cannot access database on the main thread since it may potentially lock the UI for a long period of time
- Class android.support.v4 not found after AndroidX java.lang.NoClassDefFoundError: android/support/v4/app/Fragment
Most viewed in Android
- Could not resolve Gradle: Could not resolve all files for configuration / Could not resolve dependency
- INSTALL_FAILED_USER_RESTRICTED INSTALL_FAILED_USER_RESTRICTED: Install canceled by user (Xiaomi/MIUI, Oppo, Vivo)
- INSTALL_PARSE_FAILED_NO_CERTIFICATES INSTALL_PARSE_FAILED_NO_CERTIFICATES / App not installed as package appears to be invalid
Other ways to find it
Where this error sits
Origin: On your device. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 25 Nov 2026