clockworklabs/SpacetimeDB · error · anyhow::Error

The database {name} is not registered to the identity you pr

Error message

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

What it means

The publish was denied with `PublishResult::PermissionDenied { name }`, but unlike the anonymous case the CLI does hold a token. It decodes the JWT locally (`decode_identity`, no signature verification), takes the first 12 characters of the identity as a suggested top-level domain, and returns this error: the database `name` exists on the server but is registered to a different identity than the one you are logged in as.

Source

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

                }

                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 524b4487d9)

Solutions

  1. Publish to your own suggested domain exactly as printed (e.g. `spacetime publish <suggested_tld>`)
  2. Run `spacetime login` as the account that originally created the database, then retry
  3. Check `spacetime list` to see which databases your current identity actually owns
  4. Ask the owner to share/publish the module, or pick a unique name to avoid the collision

Example fix

# before
spacetime publish someoneelses-db -s maincloud
# after
spacetime publish 1a2b3c4d5e6f7g -s maincloud   # identity-derived name from the error message
Defensive patterns

Strategy: try-catch

Validate before calling

# Confirm ownership before publishing to an existing name
spacetime list | grep -q "^mydb" || echo 'mydb not owned by current identity — expect PermissionDenied'

Try / catch

// In automation: parse the suggested domain out of the failure and retry once
let out = run_cli("spacetime publish mydb");
if let Some(sugg) = parse_after(out, "spacetime publish ") {
    run_cli(&format!("spacetime publish {}", sugg.trim()));
}

Prevention

When it happens

Trigger: Logged-in publish to a database name owned by another identity/account, or to a name you previously created under a different login; also when the stored token belongs to an old identity after re-logging in as a new user.

Common situations: Team shares a database name and a second developer tries `spacetime publish shared-name`; switching accounts via `spacetime login` and pushing to names created by the previous account; name collisions with other users on maincloud.

Related errors


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