{"record":{"id":"d222b02b48c1a947","repo":"clockworklabs/SpacetimeDB","slug":"aborting-because-publishing-would-require-manual-m","errorCode":null,"errorMessage":"Aborting because publishing would require manual migration or deletion of data and --delete-data was not specified.","messagePattern":"Aborting because publishing would require manual migration or deletion of data and --delete-data was not specified\\.","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/cli/src/subcommands/publish.rs","lineNumber":936,"sourceCode":"        program_bytes,\n        auth_header,\n    )\n    .await?\n    {\n        let major_version_upgrade = match &pre {\n            PrePublishResult::AutoMigrate(auto) => auto.major_version_upgrade,\n            PrePublishResult::ManualMigrate(manual) => manual.major_version_upgrade,\n        };\n        if major_version_upgrade {\n            confirm_major_version_upgrade(yes.migrate_major_version)?;\n        }\n\n        match pre {\n            PrePublishResult::ManualMigrate(manual) => {\n                if clear_database == ClearMode::Never {\n                    println!(\"{}\", manual.reason);\n                    println!(\"Aborting publish due to required manual migration.\");\n                    anyhow::bail!(\"Aborting because publishing would require manual migration or deletion of data and --delete-data was not specified.\");\n                }\n                println!(\"{}\", manual.reason);\n                println!(\"Proceeding with database clear due to --delete-data=on-conflict.\");\n\n                builder = confirm_and_clear(name_or_identity, yes.delete_data, builder)?;\n            }\n            PrePublishResult::AutoMigrate(auto) => {\n                println!(\"{}\", auto.migrate_plan);\n                // We only arrive here if you have not specified ClearMode::Always AND there was no\n                // conflict that required manual migration.\n                if auto.break_clients\n                    && !y_or_n(\n                        force_break_clients || yes.break_clients,\n                        \"The above changes will BREAK existing clients. Do you want to proceed?\",\n                    )?\n                {\n                    println!(\"Aborting\");\n                    // Early exit: return an error or a special signal. Here we bail out by returning Err.","sourceCodeStart":918,"sourceCodeEnd":954,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/eddf9f5014579a50d4b67630e28b6e15cad9c4af/crates/cli/src/subcommands/publish.rs#L918-L954","documentation":"Before uploading, the CLI calls the server's pre-publish check, which classifies the schema diff. PrePublishResult::ManualMigrate means the changes cannot be applied automatically (the printed manual.reason lines name the offending change). Because the clear-database mode is ClearMode::Never (the default when --delete-data is absent), the CLI aborts rather than destroy or hand-migrate data.","triggerScenarios":"`spacetime publish` to an existing database whose schema diff requires manual migration -- e.g. dropping or renaming tables, incompatible column type changes, altering indexed columns -- against a database with existing data, with no --delete-data or --delete-data=on-conflict flag.","commonSituations":"Iterating on module schemas during development; renaming/removing tables that hold rows; production publishes after schema rewrites; the exact blocking change is always printed on the lines just above this error (manual.reason).","solutions":["Read the 'reason' lines printed immediately above the error -- they name the exact change that forces manual migration.","Adjust the schema so the diff is auto-migratable (additive changes, compatible type widening) and retry.","If data loss is acceptable (dev/staging), re-run with `--delete-data=on-conflict` (clear only on conflict) or plain `--delete-data` (always clear).","For a throwaway dev database, `spacetime delete <db>` and publish fresh."],"exampleFix":"# before\nspacetime publish quickstart\n# after (dev database, data may be cleared)\nspacetime publish quickstart --delete-data=on-conflict","handlingStrategy":"try-catch","validationCode":"# In dev/staging where clearing is acceptable, opt in up front:\nspacetime publish mydb --delete-data=on-conflict\n# In prod, keep the default and review the printed manual.reason lines instead","typeGuard":null,"tryCatchPattern":"#!/usr/bin/env bash\nspacetime publish mydb\nstatus=$?\nif [ $status -ne 0 ] && spacetime publish mydb 2>&1 | tail -20 | grep -q \"requires manual migration\"; then\n  read -p \"Schema conflict: clear database data? [y/N] \" ans\n  [ \"$ans\" = y ] && spacetime publish mydb --delete-data=on-conflict\nfi","preventionTips":["Stage schema changes additively (add before remove) so the auto-migrator never hits ManualMigrate.","For disposable dev databases, standardize on --delete-data=on-conflict in your dev scripts.","Never put --delete-data in production pipelines; treat this abort as the guardrail doing its job."],"tags":["publish","schema-migration","data-loss-prevention","pre-publish-check"],"backgroundTag":"manual-migration-required","analyzedSha":"eddf9f5014579a50d4b67630e28b6e15cad9c4af","analyzedAt":"2026-08-20T06:08:37.179Z","contentChangedAt":"2026-08-20T06:08:37.179Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}