clockworklabs/SpacetimeDB · error · anyhow::Error

Host conflicts with saved configuration for server : ://

Error message

Host {} conflicts with saved configuration for server {}: {}://{}

What it means

The host-side twin of the nickname check in `spacetime server edit`: setting a new host for a server fails when that host already belongs to a different saved server. Hosts must remain unique across the CLI configuration so name resolution stays unambiguous.

Solutions

  1. Use a distinct host string (include port or scheme if the server differs)
  2. Remove the other entry that owns the host

Example fix

# before
spacetime server edit backup --host http://localhost:3000
# error: Host http://localhost:3000 conflicts with saved configuration for server ...

# after
spacetime server edit backup --host http://localhost:3001
Defensive patterns

Strategy: validation

Validate before calling

// ensure the candidate host is not owned by another server
if let Ok(other) = config.find_server(new_host) {
    if other.host != target.host {
        anyhow::bail!("host already configured for {}", other.nick_or_host());
    }
}

Try / catch

Catch the 'Host ... conflicts with saved configuration' bail and ask for a distinct host (scheme/port) instead of aborting.

Prevention

When it happens

Trigger: Calling edit_server with a new_host that find_server resolves to another server entry.

Common situations: Pointing two server entries at the same URL; editing a host by copying another server's configuration.

Related errors


AI-assisted analysis of clockworklabs/SpacetimeDB@6dee26c6ef (2026-08-20). Data as JSON: /api/errors/3d3ffef41b86f035. Report an issue: GitHub.

Appendix: source

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

        new_protocol: Option<&str>,
    ) -> anyhow::Result<(Option<String>, Option<String>, Option<String>)> {
        // Check if the new nickname or host name would introduce ambiguities between
        // server configurations.
        if let Some(new_nick) = new_nickname
            && let Ok(other_server) = self.find_server(new_nick)
        {
            anyhow::bail!(
                "Nickname {} conflicts with saved configuration for server {}: {}://{}",
                new_nick,
                other_server.nick_or_host(),
                other_server.protocol,
                other_server.host
            );
        }
        if let Some(new_host) = new_host
            && let Ok(other_server) = self.find_server(new_host)
        {
            anyhow::bail!(
                "Host {} conflicts with saved configuration for server {}: {}://{}",
                new_host,
                other_server.nick_or_host(),
                other_server.protocol,
                other_server.host
            );
        }

        let cfg = self.find_server_mut(server)?;
        let old_nickname = if let Some(new_nickname) = new_nickname {
            cfg.nickname.replace(new_nickname.to_string())
        } else {
            None
        };
        let old_host = if let Some(new_host) = new_host {
            Some(std::mem::replace(&mut cfg.host, new_host.to_string()))
        } else {
            None

View on GitHub (pinned to 6dee26c6ef)