{"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":null,"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/524b4487d949b61a07d4f39c862d1290259dfd20/crates/cli/src/config.rs#L372-L408","documentation":"The host variant of edit_server's conflict guard: changing a server's host to a value that find_server already resolves to another entry. Since hosts are the primary key of the server list (see the add-server check at config.rs:243), two entries may never share a host. The error prints the colliding server's nickname-or-host, protocol and host.","triggerScenarios":"`spacetime server edit <server> --host <new_host>` (or the equivalent host-change API) where <new_host> matches another configured server's host or nickname.","commonSituations":"Pointing two named entries (e.g. 'staging' and 'prod') at the same URL; editing a host to add/remove a port and accidentally matching another entry; migrating a server's URL that another entry already uses.","solutions":["Give the edited server a host no other entry uses (`spacetime server list` to check)","If two entries must reach the same host, remove the redundant entry and keep one","Check for a leading-scheme or trailing-slash difference that makes the new host textually identical to an existing one"],"exampleFix":"# before (fails: host already configured on entry 'mainnet')\nspacetime server edit staging --host testnet.spacetime.io\n\n# after\nspacetime server edit staging --host staging.spacetime.io","handlingStrategy":"validation","validationCode":"#!/usr/bin/env bash\n# Guard an unattended host change\nNEW_HOST='staging.spacetime.io'\nif spacetime server list | grep -q \"$NEW_HOST\"; then\n  echo \"host already configured; skipping edit\" >&2\nelse\n  spacetime server edit staging --host \"$NEW_HOST\"\nfi","typeGuard":null,"tryCatchPattern":"match config.edit_server(server, None, Some(new_host), None) {\n    Ok(res) => res,\n    Err(e) if e.to_string().starts_with(\"Host\") && e.to_string().contains(\"conflicts with saved configuration\") => {\n        // host already owned by another entry; remove that entry or pick another host\n        return Err(e);\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Treat hosts as unique primary keys across all entries; never point two nicknames at the same host","When a server moves, edit its host in place rather than adding a second entry for the new URL"],"tags":["spacetimedb","cli","server-config","duplicate-entry","naming-conflict"],"backgroundTag":"duplicate-config-entry","analyzedSha":"524b4487d949b61a07d4f39c862d1290259dfd20","analyzedAt":"2026-08-16T23:58:54.611Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}