Snapshot / Sync · error · admin

Snapshot apply failed because the target database is missing

Snapshot jobs need a resolved target database. Cupcake can get that from the replication job, the saved mapping, or the target connection default depending on the run path.

Error Codes In Plain English

target_database_required: target database is required (select target DB in replication job)

What you might see

You may see: `target database is required`, `select target DB in replication job`, or `Snapshot apply failed`.

Why it usually happens

- The replication job did not include `target_database_name`.
- The saved mapping does not have a target database.
- The target connection has no default database.
- A scheduled run path did not hydrate the job from the saved mapping.
- The target database was removed or renamed after the mapping was saved.

How to fix it

1. Open the saved mapping and confirm Source Database and Target Database are set.
2. Confirm the target connection can access the target database.
3. If this happened from Scheduler Run Now, retry after the schedule/job hydration fix is deployed.
4. If needed, recreate the snapshot job from Snapshot / Sync and select the target database explicitly.
5. Confirm the target database exists or allow Cupcake to create it when that workflow supports creation.

How to avoid it next time

Prefer saving mappings with explicit source and target databases. Avoid relying only on connection-level default databases for production schedules.

SQL to check

```sql
SELECT DATABASE();
SHOW DATABASES LIKE 'target_database_name';
SHOW GRANTS FOR CURRENT_USER();
```