clockworklabs/SpacetimeDB · error

Server nickname {} already in use: {}://{}

Error message

Server nickname {} already in use: {}://{}

What it means

RawConfig::add_server (crates/cli/src/config.rs:229) rejects a nickname that already resolves to a saved server (find_server matches by nickname or host), printing the existing entry as protocol://host so the collision is visible. Nicknames must stay unique for --server lookups to be unambiguous.

Source

Thrown at crates/cli/src/config.rs:229

            let default = default_server.to_string();
            self.find_server_mut(&default)
                .with_context(|| hanging_default_server_context(&default))
        } else {
            Err(anyhow::anyhow!(NO_DEFAULT_SERVER_ERROR_MESSAGE))
        }
    }

    fn add_server(
        &mut self,
        host: String,
        protocol: String,
        ecdsa_public_key: Option<String>,
        nickname: Option<String>,
    ) -> anyhow::Result<()> {
        if let Some(nickname) = &nickname
            && let Ok(cfg) = self.find_server(nickname)
        {
            anyhow::bail!(
                "Server nickname {} already in use: {}://{}",
                nickname,
                cfg.protocol,
                cfg.host,
            );
        }

        if let Ok(cfg) = self.find_server(&host) {
            if let Some(nick) = &cfg.nickname
                && nick == &host
            {
                anyhow::bail!("Server host name is ambiguous with existing server nickname: {nick}");
            }
            anyhow::bail!("Server already configured for host: {host}");
        }

        self.server_configs.push(ServerConfig {
            nickname,

View on GitHub (pinned to 524b4487d9)

Solutions

  1. Choose a different nickname for the new server
  2. If you meant to replace it: spacetime server remove <nickname>, then re-add with the new URL
  3. Run spacetime server list first to see existing nicknames and hosts

Example fix

# before
spacetime server add testnet --url https://testnet2.spacetimedb.com  # Error: nickname already in use

# after
spacetime server remove testnet
spacetime server add testnet --url https://testnet2.spacetimedb.com
Defensive patterns

Strategy: validation

Validate before calling

# Check for a nickname clash before adding:
if spacetime server list | awk '{print $1}' | grep -qx "${NICK}"; then
  echo "nickname '${NICK}' already exists" >&2; exit 2
fi
spacetime server add "${NICK}" --url "${URL}"

Prevention

When it happens

Trigger: Running spacetime server add testnet --url <url> when 'testnet' already names a saved server, even if the new URL differs.

Common situations: Re-running a setup/provisioning script that adds the same environment twice; adding the same cluster under a new URL with the old nickname; conflicting entries after importing a teammate's config.

Related errors


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