clockworklabs/SpacetimeDB · error · anyhow::Error

Database {database_identity} not found

Error message

Database {database_identity} not found

What it means

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.

Source

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

        .put(format!(
            "{}/v1/database/{database_identity}/names",
            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. Get the correct identity from the right server: `spacetime list --server <srv>` (or `spacetime logs`/publish output) and re-run rename with it
  2. Double-check you are targeting the server where the database is published via `--server`
  3. Re-copy the full identity string — it is long and easy to truncate
  4. If the database was deleted, re-publish it before renaming

Example fix

# before
spacetime rename --to new-name mydb
# after
spacetime list && spacetime rename --to new-name 9d4c0e6...full-identity-hex
Defensive patterns

Strategy: validation

Validate before calling

# Confirm the identity exists on the exact server before renaming
srv=maincloud
id=$(spacetime list --server $srv | awk '/mydb/{print $identity}')
[ -n "$id" ] || { echo 'db not found on server'; exit 1; }
spacetime rename --to new-name "$id" --server $srv

Try / catch

// On 'Database ... not found', re-enumerate via `spacetime list --server <srv>`; retry only with a freshly confirmed identity.

Prevention

When it happens

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

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

Related errors


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