{"record":{"id":"5ca0f5d259b9469b","repo":"clockworklabs/SpacetimeDB","slug":"you-cannot-rename-database-identity-because-it-i","errorCode":null,"errorMessage":"You cannot rename {database_identity} because it is owned by another identity.","messagePattern":"You cannot rename (.+?) because it is owned by another identity\\.","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/cli/src/subcommands/dns.rs","lineNumber":58,"sourceCode":"            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":40,"sourceCodeEnd":67,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/524b4487d949b61a07d4f39c862d1290259dfd20/crates/cli/src/subcommands/dns.rs#L40-L67","documentation":"Response mapping for `spacetime rename`: the server returned `NotYourDatabase` — the database identity exists, but it is owned by a different identity than the one your auth token authenticates. Renaming (setting a domain) requires ownership, so the request is rejected even though the database is visible.","triggerScenarios":"Using a token/identity that is not the publisher of the database: logged in as a personal account for a team-published database, multiple profiles on one machine, or an expired token that silently re-authenticated as another identity.","commonSituations":"Team shares where only the original publisher may rename; switching between `spacetime login` accounts; CI credentials differing from the human's; publishing under anon/local identity then renaming while authed to maincloud.","solutions":["Check who you are: `spacetime identity show` (per server) and compare with the database owner shown by `spacetime list --server <srv>`","Log in as the owning identity: `spacetime server login <server>` then retry the rename","If ownership should have transferred or is ambiguous, have the current owner perform the rename or publish the database anew under the correct identity"],"exampleFix":"# before (authed as wrong identity)\nspacetime rename --to new-name <db-identity>\n# after\nspacetime server login maincloud && spacetime rename --to new-name <db-identity>","handlingStrategy":"validation","validationCode":"# Verify caller identity matches the database owner\nme=$(spacetime identity show --server maincloud)\nspacetime list --server maincloud  # compare owner of the target db before rename","typeGuard":null,"tryCatchPattern":"// On 'owned by another identity', stop and re-authenticate as the owner (`spacetime server login`); retrying with the same token always fails.","preventionTips":["One identity per project; document who published each database","Re-check `spacetime identity show` after switching accounts or CI credentials"],"tags":["cli","dns","rename","ownership","authorization","spacetimedb"],"backgroundTag":"resource-owned-by-other","analyzedSha":"524b4487d949b61a07d4f39c862d1290259dfd20","analyzedAt":"2026-08-16T23:58:54.611Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}