clockworklabs/SpacetimeDB · error · anyhow::Error

Aborting because publishing would require manual migration o

Error message

Aborting because publishing would require manual migration or deletion of data and --delete-data was not specified.

What it means

The pre-publish check (`call_pre_publish`) returned `PrePublishResult::ManualMigrate`, meaning the new module schema cannot be auto-migrated from the existing one. The CLI prints the server's `manual.reason`, then — because `clear_database` is `ClearMode::Never` (no `--delete-data`) — it refuses to continue: proceeding would require manual migration or wiping the database's data.

Source

Thrown at crates/cli/src/subcommands/publish.rs:795

        program_bytes,
        auth_header,
    )
    .await?
    {
        let major_version_upgrade = match &pre {
            PrePublishResult::AutoMigrate(auto) => auto.major_version_upgrade,
            PrePublishResult::ManualMigrate(manual) => manual.major_version_upgrade,
        };
        if major_version_upgrade {
            confirm_major_version_upgrade(yes.migrate_major_version)?;
        }

        match pre {
            PrePublishResult::ManualMigrate(manual) => {
                if clear_database == ClearMode::Never {
                    println!("{}", manual.reason);
                    println!("Aborting publish due to required manual migration.");
                    anyhow::bail!("Aborting because publishing would require manual migration or deletion of data and --delete-data was not specified.");
                }
                println!("{}", manual.reason);
                println!("Proceeding with database clear due to --delete-data=on-conflict.");

                builder = confirm_and_clear(name_or_identity, yes.delete_data, builder)?;
            }
            PrePublishResult::AutoMigrate(auto) => {
                println!("{}", auto.migrate_plan);
                // We only arrive here if you have not specified ClearMode::Always AND there was no
                // conflict that required manual migration.
                if auto.break_clients
                    && !y_or_n(
                        force_break_clients || yes.break_clients,
                        "The above changes will BREAK existing clients. Do you want to proceed?",
                    )?
                {
                    println!("Aborting");
                    // Early exit: return an error or a special signal. Here we bail out by returning Err.

View on GitHub (pinned to 524b4487d9)

Solutions

  1. Re-run with `--delete-data` (maps to ClearMode::OnConflict) if the data is disposable: the CLI will confirm and clear the database before publishing
  2. If the data matters, follow the printed `manual.reason` and perform the migration manually, or revert the schema change so auto-migration applies
  3. Back up / export needed rows before clearing, since clearing deletes all database data
  4. For development loops, keep a seed script so `--delete-data` re-publishes are cheap

Example fix

# before
spacetime publish mydb   # requires manual migration -> aborted
# after
spacetime publish mydb --delete-data
Defensive patterns

Strategy: validation

Validate before calling

# In throwaway dev databases, make data loss explicit up front
spacetime publish mydb --delete-data   # instead of plain publish

Prevention

When it happens

Trigger: Publishing schema changes the server deems non-auto-migratable (dropped/retyped tables, incompatible row changes) to an existing database without passing `--delete-data`; also after a major version upgrade prompt was confirmed but the plan still needs manual work.

Common situations: Iterating on a module during development and making incompatible table edits against a local database you no longer care about; publishing an intentional breaking schema change to a database with live data; upgrading the module SDK across a major version boundary.

Related errors


AI-assisted analysis of clockworklabs/SpacetimeDB@524b4487d9 (2026-08-16). Data as JSON: /api/errors/d222b02b48c1a947. Report an issue: GitHub.