clockworklabs/SpacetimeDB · warning · anyhow::Error

Aborted.

Error message

Aborted.

What it means

Publishing with --clear-database (or a schema change that requires clearing) first shows a destructive-action prompt: 'This will DESTROY the current <db> module, and ALL corresponding data.' Answering anything other than yes (without -y/--yes) raises this bail and no publish happens. The database is untouched.

Solutions

  1. If you truly want to wipe, rerun and answer y, or pass -y/--yes in automation
  2. If not, drop --clear-database and fix schema changes to be backwards-compatible instead
  3. Use `spacetime generate` + migration workflow to avoid needing clears

Example fix

# before
spacetime publish mydb --clear-database   # answered n -> Aborted.
# after
spacetime publish mydb                     # no clear, no prompt
Defensive patterns

Strategy: validation

Try / catch

if let Err(e) = publish_exec().await {
    if e.to_string() == "Aborted." {
        // user declined destructive clear: exit 0 or prompt differently
    }
}

Prevention

When it happens

Trigger: Running `spacetime publish --clear-database` and answering 'n' at the prompt; a CI job wired to a TTY where someone declines; interactive publish where the schema update requires clear and the user aborts.

Common situations: Shared dev databases where wiping data is costly; cautious manual publishing; accidentally passing --clear-database.

Related errors


AI-assisted analysis of clockworklabs/SpacetimeDB@eddf9f5014 (2026-08-20). Data as JSON: /api/errors/3c02d50c23097eda. Report an issue: GitHub.

Appendix: source

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

        // Preserve older servers for ordinary modules without environment changes.
        Ok(("application/octet-stream", bytes))
    }
}

fn confirm_and_clear(
    name_or_identity: &str,
    skip_prompt: bool,
    mut builder: reqwest::RequestBuilder,
) -> Result<reqwest::RequestBuilder, anyhow::Error> {
    println!(
        "This will DESTROY the current {} module, and ALL corresponding data.",
        name_or_identity
    );
    if !y_or_n(
        skip_prompt,
        format!("Are you sure you want to proceed? [deleting {}]", name_or_identity).as_str(),
    )? {
        anyhow::bail!("Aborted.");
    }

    builder = builder.query(&[("clear", true)]);
    Ok(builder)
}

fn confirm_major_version_upgrade(skip_prompt: bool) -> Result<(), anyhow::Error> {
    println!(
        "It looks like you're trying to do a major version upgrade from 1.0 to 2.0. We recommend first looking at the upgrade notes before committing to this upgrade: https://spacetimedb.com/docs/upgrade"
    );
    println!();
    println!("WARNING: Once you publish you cannot revert back to version 1.0.");
    println!();

    if skip_prompt {
        return Ok(());
    }

View on GitHub (pinned to eddf9f5014)