# alembic.util.exc.CommandError: Target database is not up to date.

- **ID:** `python/flask-migrate-target-database-not-up-to-date`
- **Domain:** python
- **Category:** config_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Running `flask db migrate` while the DB revision is behind the latest migration head, or after manual schema edits.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 4.0.x | active | — | — |

## Workarounds

1. **** (95% success)
   ```
   Run `flask db upgrade` first, then `flask db migrate -m 'msg'` and `flask db upgrade` again.
   ```
2. **** (85% success)
   ```
   If DB drifted, stamp: `flask db stamp head` after manually aligning schema, then migrate.
   ```

## Dead Ends

- **** — Loses migration history; production DB will not match. (95% fail)
- **** — Offline mode still requires up-to-date revision. (80% fail)
