{"record":{"id":"b59ff425f86d6c4d","repo":"clockworklabs/SpacetimeDB","slug":"database-does-not-exist","errorCode":null,"errorMessage":"Database `{}` does not exist","messagePattern":"Database `(.+?)` does not exist","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/standalone/src/lib.rs","lineNumber":395,"sourceCode":"        spec: spacetimedb_client_api::DatabaseDef,\n        style: PrettyPrintStyle,\n    ) -> anyhow::Result<MigratePlanResult> {\n        let existing_db = self.control_db.get_database_by_identity(&spec.database_identity)?;\n\n        match existing_db {\n            Some(db) => {\n                let host = self.leader(db.id).await?;\n                self.host_controller\n                    .migrate_plan(\n                        db,\n                        spec.host_type,\n                        host.replica_id,\n                        spec.program_bytes.to_vec().into(),\n                        style,\n                    )\n                    .await\n            }\n            None => anyhow::bail!(\n                \"Database `{}` does not exist\",\n                spec.database_identity.to_abbreviated_hex()\n            ),\n        }\n    }\n\n    async fn delete_database(&self, _caller_identity: &Identity, database_identity: &Identity) -> anyhow::Result<()> {\n        let Some(database) = self.control_db.get_database_by_identity(database_identity)? else {\n            return Ok(());\n        };\n        self.control_db.delete_database(database.id)?;\n\n        for instance in self.control_db.get_replicas_by_database(database.id)? {\n            self.delete_replica(instance.id).await?;\n        }\n\n        Ok(())\n    }","sourceCodeStart":377,"sourceCodeEnd":413,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/fb7282411b0b73cc68d51e161f180cd409abd851/crates/standalone/src/lib.rs#L377-L413","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Publish by name to (re)create the database: spacetime publish <db-name> on the correct server.","Verify the database exists on the target server: spacetime list / spacetime describe <db>.","Check the server URL and data directory match where the database was originally created."],"exampleFix":"# before: publishing to a missing identity\nspacetime publish --skip-programs my-db # -> Database `<abbrev>` does not exist\n\n# after: target the right server / recreate by name\nspacetime server list\nspacetime server use local\nspacetime publish my-db","handlingStrategy":"validation","validationCode":"# before publishing to an existing identity, verify it exists on that server:\nspacetime list\nspacetime describe my-db\n# missing -> publish by name to create it, or fix the server URL","typeGuard":null,"tryCatchPattern":"match env.migrate_plan(spec).await {\n    Err(e) if e.to_string().contains(\"does not exist\") => {\n        // create the database (publish by name), then retry the migrate\n    }\n    other => other,\n}","preventionTips":["Pin the correct server with spacetime server use before publishing.","After resetting a data directory, recreate databases by name rather than reusing old identities.","Script publishes to verify the database exists first."],"tags":["standalone","database-not-found","publish","migrate"],"backgroundTag":"database-not-found","analyzedSha":"fb7282411b0b73cc68d51e161f180cd409abd851","analyzedAt":"2026-08-20T06:08:37.179Z","contentChangedAt":"2026-08-20T06:08:37.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}