clockworklabs/SpacetimeDB · error · anyhow::Error

You cannot rename {database_identity} because it is owned by

Error message

You cannot rename {database_identity} because it is owned by another identity.

What it means

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.

Source

Thrown at crates/cli/src/subcommands/dns.rs:58

            config.get_host_url(server)?
        ))
        .header(reqwest::header::CONTENT_TYPE, "application/json")
        .body(serde_json::to_string(&[&domain])?);
    let builder = add_auth_header_opt(builder, &auth_header);

    let response = builder.send().await?;
    let status = &response.status();
    let result: SetDomainsResult = response.json_or_error().await?;

    if !status.is_success() {
        anyhow::bail!(match result {
            SetDomainsResult::Success => "".to_string(),
            SetDomainsResult::PermissionDenied { domain } => format!("Permission denied for domain: {domain}"),
            SetDomainsResult::PermissionDeniedOnAny { domains } =>
                format!("Permission denied for domains: {domains:?}"),
            SetDomainsResult::DatabaseNotFound => format!("Database {database_identity} not found"),
            SetDomainsResult::NotYourDatabase { .. } =>
                format!("You cannot rename {database_identity} because it is owned by another identity."),
            SetDomainsResult::OtherError(err) => err,
        });
    }

    println!("Name set to {domain} for identity {database_identity}.");

    Ok(())
}

View on GitHub (pinned to 524b4487d9)

Solutions

  1. Check who you are: `spacetime identity show` (per server) and compare with the database owner shown by `spacetime list --server <srv>`
  2. Log in as the owning identity: `spacetime server login <server>` then retry the rename
  3. If ownership should have transferred or is ambiguous, have the current owner perform the rename or publish the database anew under the correct identity

Example fix

# before (authed as wrong identity)
spacetime rename --to new-name <db-identity>
# after
spacetime server login maincloud && spacetime rename --to new-name <db-identity>
Defensive patterns

Strategy: validation

Validate before calling

# Verify caller identity matches the database owner
me=$(spacetime identity show --server maincloud)
spacetime list --server maincloud  # compare owner of the target db before rename

Try / catch

// On 'owned by another identity', stop and re-authenticate as the owner (`spacetime server login`); retrying with the same token always fails.

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of clockworklabs/SpacetimeDB@524b4487d9 (2026-08-16). Data as JSON: /api/errors/5ca0f5d259b9469b. Report an issue: GitHub.