clockworklabs/SpacetimeDB · error · anyhow::Error

The database is not registered to the identity you…

Error message

The database {name} is not registered to the identity you provided.\nWe suggest you push to either a domain owned by you, or a new domain like:\n\tspacetime publish {suggested_tld}\n

What it means

Thrown by `spacetime publish` when the server responds with PublishResult::PermissionDenied: the target database name exists but is registered to a different identity than the one in your login token. The CLI decodes your JWT without signature verification, takes the first 12 characters of your identity, and suggests pushing to a fresh domain named after them.

Solutions

  1. Publish to a fresh, unused name — e.g. the suggested `spacetime publish <first-12-chars-of-your-identity>` from the error message
  2. Run `spacetime whoami` to confirm which identity you are, then `spacetime login` as the actual owner of the database
  3. Ask the current owner to publish the update, or have them delete/re-register the database under your identity
  4. Verify you are targeting the intended server with `spacetime server list` — the name may be free on a different server

Example fix

# before
spacetime publish quickstart-db   # name registered to another identity

# after
spacetime publish ab12cd34ef56     # or any unused name; identity prefix shown in the error
Defensive patterns

Strategy: validation

Validate before calling

# before publishing (CI), confirm the identity and prefer names derived from it
spacetime whoami
NAME="$(spacetime whoami | tail -c 13)"   # first 12 chars heuristic; or pin a known-owned name
spacetime publish "$NAME"

Try / catch

// Rust (internal API users): match the typed result before it becomes an error
match publish_result {
    PublishResult::PermissionDenied { name } => { /* prompt for a new domain or re-login */ }
    other => { /* proceed */ }
}

Prevention

When it happens

Trigger: `spacetime publish <name>` where <name> was created/registered by another identity; publishing while logged in as a different user than the database owner; targeting a name already taken on the selected server. (An anonymous session hits the separate 'log in as the owner' bail instead.)

Common situations: A teammate originally published the database under their account; name collisions on shared servers (testnet/mainnet); still logged in with an old token after switching accounts or servers; CI publishing with a token from the wrong user.

Understand the failure class

Background: Permission denied / not authorized / 403 Forbidden: access-control rejections when the caller lacks the required role, grant, or ownership — this error's family across 18 libraries.

Related errors


AI-assisted analysis of clockworklabs/SpacetimeDB@eddf9f5014 (2026-08-20). Data as JSON: /api/errors/0ec0a8085f5f8d5e. Report an issue: GitHub.

Appendix: source

Thrown at crates/cli/src/subcommands/publish.rs:812

                }

                if is_maincloud_host(&database_host)
                    && let Some(domain) = domain.as_ref()
                {
                    println!("Dashboard: https://spacetimedb.com/{}", domain.as_ref());
                }
            }
            PublishResult::PermissionDenied { name } => {
                if anon_identity {
                    anyhow::bail!("You need to be logged in as the owner of {name} to publish to {name}",);
                }
                // If we're not in the `anon_identity` case, then we have already forced the user to log in above (using `get_auth_header`), so this should be safe to unwrap.
                let token = config.spacetimedb_token().unwrap();
                let identity = decode_identity(token)?;
                //TODO(jdetter): Have a nice name generator here, instead of using some abstract characters
                // we should perhaps generate fun names like 'green-fire-dragon' instead
                let suggested_tld: String = identity.chars().take(12).collect();
                return Err(anyhow::anyhow!(
                    "The database {name} is not registered to the identity you provided.\n\
                    We suggest you push to either a domain owned by you, or a new domain like:\n\
                    \tspacetime publish {suggested_tld}\n",
                ));
            }
        }
    }

    Ok(())
}

fn default_publish_module_path(current_dir: &std::path::Path) -> PathBuf {
    let spacetimedb_dir = current_dir.join("spacetimedb");
    if spacetimedb_dir.is_dir() {
        spacetimedb_dir
    } else {
        current_dir.to_path_buf()
    }

View on GitHub (pinned to eddf9f5014)