clockworklabs/SpacetimeDB · error

Database `{}` does not exist

Error message

Database `{}` does not exist

What it means

StandaloneEnv::migrate_plan looks up the target database by identity in the control database before migrating. A None match means no database with that identity is registered in this standalone instance, so the publish/migrate request is rejected with the abbreviated identity in the message.

Source

Thrown at crates/standalone/src/lib.rs:395

        spec: spacetimedb_client_api::DatabaseDef,
        style: PrettyPrintStyle,
    ) -> anyhow::Result<MigratePlanResult> {
        let existing_db = self.control_db.get_database_by_identity(&spec.database_identity)?;

        match existing_db {
            Some(db) => {
                let host = self.leader(db.id).await?;
                self.host_controller
                    .migrate_plan(
                        db,
                        spec.host_type,
                        host.replica_id,
                        spec.program_bytes.to_vec().into(),
                        style,
                    )
                    .await
            }
            None => anyhow::bail!(
                "Database `{}` does not exist",
                spec.database_identity.to_abbreviated_hex()
            ),
        }
    }

    async fn delete_database(&self, _caller_identity: &Identity, database_identity: &Identity) -> anyhow::Result<()> {
        let Some(database) = self.control_db.get_database_by_identity(database_identity)? else {
            return Ok(());
        };
        self.control_db.delete_database(database.id)?;

        for instance in self.control_db.get_replicas_by_database(database.id)? {
            self.delete_replica(instance.id).await?;
        }

        Ok(())
    }

View on GitHub (pinned to fb7282411b)

Solutions

  1. Publish by name to (re)create the database: spacetime publish <db-name> on the correct server.
  2. Verify the database exists on the target server: spacetime list / spacetime describe <db>.
  3. Check the server URL and data directory match where the database was originally created.

Example fix

# before: publishing to a missing identity
spacetime publish --skip-programs my-db # -> Database `<abbrev>` does not exist

# after: target the right server / recreate by name
spacetime server list
spacetime server use local
spacetime publish my-db
Defensive patterns

Strategy: validation

Validate before calling

# before publishing to an existing identity, verify it exists on that server:
spacetime list
spacetime describe my-db
# missing -> publish by name to create it, or fix the server URL

Try / catch

match env.migrate_plan(spec).await {
    Err(e) if e.to_string().contains("does not exist") => {
        // create the database (publish by name), then retry the migrate
    }
    other => other,
}

Prevention

When it happens

Trigger: Publishing or migrating to a database identity that does not exist on the target standalone server: fresh data directory, wrong server URL, or the database was deleted.

Common situations: Local manifest still referencing an old database identity after the standalone data dir was reset; publishing to a different spacetimedb start instance than the one where the database was created; publishing after spacetetime delete.

Related errors


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