{"record":{"id":"54f467ef0d68cae8","repo":"clockworklabs/SpacetimeDB","slug":"database-database-identity-not-found","errorCode":null,"errorMessage":"Database {database_identity} not found","messagePattern":"Database (.+?) not found","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/cli/src/subcommands/dns.rs","lineNumber":56,"sourceCode":"        .put(format!(\n            \"{}/v1/database/{database_identity}/names\",\n            config.get_host_url(server)?\n        ))\n        .header(reqwest::header::CONTENT_TYPE, \"application/json\")\n        .body(serde_json::to_string(&[&domain])?);\n    let builder = add_auth_header_opt(builder, &auth_header);\n\n    let response = builder.send().await?;\n    let status = &response.status();\n    let result: SetDomainsResult = response.json_or_error().await?;\n\n    if !status.is_success() {\n        anyhow::bail!(match result {\n            SetDomainsResult::Success => \"\".to_string(),\n            SetDomainsResult::PermissionDenied { domain } => format!(\"Permission denied for domain: {domain}\"),\n            SetDomainsResult::PermissionDeniedOnAny { domains } =>\n                format!(\"Permission denied for domains: {domains:?}\"),\n            SetDomainsResult::DatabaseNotFound => format!(\"Database {database_identity} not found\"),\n            SetDomainsResult::NotYourDatabase { .. } =>\n                format!(\"You cannot rename {database_identity} because it is owned by another identity.\"),\n            SetDomainsResult::OtherError(err) => err,\n        });\n    }\n\n    println!(\"Name set to {domain} for identity {database_identity}.\");\n\n    Ok(())\n}\n","sourceCodeStart":38,"sourceCodeEnd":67,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/524b4487d949b61a07d4f39c862d1290259dfd20/crates/cli/src/subcommands/dns.rs#L38-L67","documentation":"Response mapping for `spacetime rename`: the server returned `DatabaseNotFound` for the identity in the URL path. The CLI sent `PUT /v1/database/{database_identity}/names` and no database with that Address/Identity exists on the target server. Note the identity argument is a database identity (hex address), not a database name — mixing these up is the most common cause.","triggerScenarios":"Passing a database name or a typo'd/truncated identity string; the database was deleted or published to a different server; targeting the wrong `--server` than where the database lives.","commonSituations":"Copy-paste truncation of long identity strings; renaming after `spacetime delete` or on a fresh server; pointing at `maincloud` when the database is on `local` (or vice versa) because `--server`/default differs.","solutions":["Get the correct identity from the right server: `spacetime list --server <srv>` (or `spacetime logs`/publish output) and re-run rename with it","Double-check you are targeting the server where the database is published via `--server`","Re-copy the full identity string — it is long and easy to truncate","If the database was deleted, re-publish it before renaming"],"exampleFix":"# before\nspacetime rename --to new-name mydb\n# after\nspacetime list && spacetime rename --to new-name 9d4c0e6...full-identity-hex","handlingStrategy":"validation","validationCode":"# Confirm the identity exists on the exact server before renaming\nsrv=maincloud\nid=$(spacetime list --server $srv | awk '/mydb/{print $identity}')\n[ -n \"$id\" ] || { echo 'db not found on server'; exit 1; }\nspacetime rename --to new-name \"$id\" --server $srv","typeGuard":null,"tryCatchPattern":"// On 'Database ... not found', re-enumerate via `spacetime list --server <srv>`; retry only with a freshly confirmed identity.","preventionTips":["Always pass --server explicitly on rename","Copy identities from command output, never by hand"],"tags":["cli","dns","rename","not-found","spacetimedb"],"backgroundTag":"resource-not-found","analyzedSha":"524b4487d949b61a07d4f39c862d1290259dfd20","analyzedAt":"2026-08-16T23:58:54.611Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}