{"record":{"id":"3d3ffef41b86f035","repo":"clockworklabs/SpacetimeDB","slug":"host-conflicts-with-saved-configuration-for-ser","errorCode":null,"errorMessage":"Host {} conflicts with saved configuration for server {}: {}://{}","messagePattern":"Host (.+?) conflicts with saved configuration for server (.+?): (.+?)://(.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/cli/src/config.rs","lineNumber":390,"sourceCode":"        new_protocol: Option<&str>,\n    ) -> anyhow::Result<(Option<String>, Option<String>, Option<String>)> {\n        // Check if the new nickname or host name would introduce ambiguities between\n        // server configurations.\n        if let Some(new_nick) = new_nickname\n            && let Ok(other_server) = self.find_server(new_nick)\n        {\n            anyhow::bail!(\n                \"Nickname {} conflicts with saved configuration for server {}: {}://{}\",\n                new_nick,\n                other_server.nick_or_host(),\n                other_server.protocol,\n                other_server.host\n            );\n        }\n        if let Some(new_host) = new_host\n            && let Ok(other_server) = self.find_server(new_host)\n        {\n            anyhow::bail!(\n                \"Host {} conflicts with saved configuration for server {}: {}://{}\",\n                new_host,\n                other_server.nick_or_host(),\n                other_server.protocol,\n                other_server.host\n            );\n        }\n\n        let cfg = self.find_server_mut(server)?;\n        let old_nickname = if let Some(new_nickname) = new_nickname {\n            cfg.nickname.replace(new_nickname.to_string())\n        } else {\n            None\n        };\n        let old_host = if let Some(new_host) = new_host {\n            Some(std::mem::replace(&mut cfg.host, new_host.to_string()))\n        } else {\n            None","sourceCodeStart":372,"sourceCodeEnd":408,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/6dee26c6efc2856793e12b148a59742964f5d783/crates/cli/src/config.rs#L372-L408","documentation":"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.","triggerScenarios":"Calling edit_server with a new_host that find_server resolves to another server entry.","commonSituations":"Pointing two server entries at the same URL; editing a host by copying another server's configuration.","solutions":["Use a distinct host string (include port or scheme if the server differs)","Remove the other entry that owns the host"],"exampleFix":"# before\nspacetime server edit backup --host http://localhost:3000\n# error: Host http://localhost:3000 conflicts with saved configuration for server ...\n\n# after\nspacetime server edit backup --host http://localhost:3001","handlingStrategy":"validation","validationCode":"// ensure the candidate host is not owned by another server\nif let Ok(other) = config.find_server(new_host) {\n    if other.host != target.host {\n        anyhow::bail!(\"host already configured for {}\", other.nick_or_host());\n    }\n}","typeGuard":null,"tryCatchPattern":"Catch the 'Host ... conflicts with saved configuration' bail and ask for a distinct host (scheme/port) instead of aborting.","preventionTips":["Include the port in host strings so distinct servers never collide","Prefer editing the existing entry over duplicating a host"],"tags":["cli","config","server","host","conflict"],"backgroundTag":"duplicate-config-entry","analyzedSha":"6dee26c6efc2856793e12b148a59742964f5d783","analyzedAt":"2026-08-20T06:08:37.179Z","contentChangedAt":"2026-08-20T06:08:37.179Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}