{"record":{"id":"43f6f50c789b42cf","repo":"clockworklabs/SpacetimeDB","slug":"mismatched-owner-identity","errorCode":null,"errorMessage":"mismatched owner identity: {} != {}","messagePattern":"mismatched owner identity: (.+?) != (.+?)","errorType":"exception","errorClass":"DBError","httpStatus":null,"severity":"critical","filePath":"crates/engine/src/relational_db.rs","lineNumber":352,"sourceCode":"            database_identity,\n            owner_identity,\n            inner,\n            persistence,\n            metrics_recorder_queue,\n        );\n        db.migrate_system_tables()?;\n\n        if let Some(meta) = db.metadata()? {\n            if meta.database_identity != database_identity {\n                return Err(anyhow!(\n                    \"mismatched database identity: {} != {}\",\n                    meta.database_identity,\n                    database_identity\n                )\n                .into());\n            }\n            if meta.owner_identity != owner_identity {\n                return Err(anyhow!(\n                    \"mismatched owner identity: {} != {}\",\n                    meta.owner_identity,\n                    owner_identity\n                )\n                .into());\n            }\n        };\n        let connected_clients = db.connected_clients()?;\n\n        Ok((db, connected_clients))\n    }\n\n    /// Shut down the database, without dropping it.\n    ///\n    /// If the database is in-memory only, this does nothing.\n    /// Otherwise, it instructs the durability layer to shut down\n    /// and waits until all outstanding transactions are reported as durable.\n    ///","sourceCodeStart":334,"sourceCodeEnd":370,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/3653d2ed498fddbd83b7062aa6bf8970e18635ec/crates/engine/src/relational_db.rs#L334-L370","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Pass the owner identity that matches the persisted metadata (the one shown in the error message)","If ownership was intentionally transferred on disk, update the host configuration that still holds the old owner identity","If the copy is legitimate, re-initialize ownership through the supported path rather than opening with mismatched identities"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match RelationalDB::open(database_identity, owner_identity, history, persistence, queue, pool) {\n    Err(e) if e.to_string().starts_with(\"mismatched owner identity\") => {\n        // read the persisted owner from the error and reconcile config with it\n        log::error!(\"open refused: {e}; update the owner_identity argument or re-register the database\");\n        return Err(e);\n    }\n    r => r,\n}","preventionTips":["After any ownership transfer, update every host config that opens the database","When cloning databases for tests, re-initialize ownership through supported APIs","Include both identities in open logging to catch mismatches early"],"tags":["rust","spacetimedb","database","identity","ownership","startup"],"backgroundTag":"database-identity-mismatch","analyzedSha":"3653d2ed498fddbd83b7062aa6bf8970e18635ec","analyzedAt":"2026-08-20T06:08:37.179Z","contentChangedAt":"2026-08-20T06:08:37.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}