clockworklabs/SpacetimeDB · critical · DBError

mismatched owner identity: {} != {}

Error message

mismatched owner identity: {} != {}

What it means

RelationalDB::open cross-checks the owner identity in the database's persisted metadata (st_module) against the owner_identity argument. The database_identity matched but the owner recorded on disk differs from the one supplied, so the open is refused to prevent operating a database under the wrong owner.

Source

Thrown at crates/engine/src/relational_db.rs:352

            database_identity,
            owner_identity,
            inner,
            persistence,
            metrics_recorder_queue,
        );
        db.migrate_system_tables()?;

        if let Some(meta) = db.metadata()? {
            if meta.database_identity != database_identity {
                return Err(anyhow!(
                    "mismatched database identity: {} != {}",
                    meta.database_identity,
                    database_identity
                )
                .into());
            }
            if meta.owner_identity != owner_identity {
                return Err(anyhow!(
                    "mismatched owner identity: {} != {}",
                    meta.owner_identity,
                    owner_identity
                )
                .into());
            }
        };
        let connected_clients = db.connected_clients()?;

        Ok((db, connected_clients))
    }

    /// Shut down the database, without dropping it.
    ///
    /// If the database is in-memory only, this does nothing.
    /// Otherwise, it instructs the durability layer to shut down
    /// and waits until all outstanding transactions are reported as durable.
    ///

View on GitHub (pinned to 3653d2ed49)

Solutions

  1. Pass the owner identity that matches the persisted metadata (the one shown in the error message)
  2. If ownership was intentionally transferred on disk, update the host configuration that still holds the old owner identity
  3. If the copy is legitimate, re-initialize ownership through the supported path rather than opening with mismatched identities
Defensive patterns

Strategy: try-catch

Try / catch

match RelationalDB::open(database_identity, owner_identity, history, persistence, queue, pool) {
    Err(e) if e.to_string().starts_with("mismatched owner identity") => {
        // read the persisted owner from the error and reconcile config with it
        log::error!("open refused: {e}; update the owner_identity argument or re-register the database");
        return Err(e);
    }
    r => r,
}

Prevention

When it happens

Trigger: Database ownership was changed (metadata updated) but the host still opens with the previous owner identity; a database directory copied/cloned and registered under a different owner; host config drift between publish and open paths.

Common situations: Ownership transfer operations followed by hosts running stale configuration; test setups that clone database files without updating the owner identity argument; multi-host environments with inconsistent identity config.

Related errors


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