{"record":{"id":"c4425a7ccab0a6af","repo":"clockworklabs/SpacetimeDB","slug":"nickname-conflicts-with-saved-configuration-for","errorCode":null,"errorMessage":"Nickname {} conflicts with saved configuration for server {}: {}://{}","messagePattern":"Nickname (.+?) conflicts with saved configuration for server (.+?): (.+?)://(.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/cli/src/config.rs","lineNumber":379,"sourceCode":"    ///\n    /// Implements `spacetime server edit`.\n    ///\n    /// Returns `Err` if no such server exists.\n    /// On success, returns `(old_nickname, old_host, hold_protocol)`,\n    /// with `Some` for each field that was changed.\n    pub fn edit_server(\n        &mut self,\n        server: &str,\n        new_nickname: Option<&str>,\n        new_host: Option<&str>,\n        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        }","sourceCodeStart":361,"sourceCodeEnd":397,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/524b4487d949b61a07d4f39c862d1290259dfd20/crates/cli/src/config.rs#L361-L397","documentation":"edit_server (used by `spacetime server edit`) refuses to rename a server to a nickname that find_server can already resolve — i.e. a string matching another entry's nickname OR host. The uniqueness invariant is what lets every server be addressed unambiguously by name; the error names the colliding server along with its protocol and host so you can see what you collided with.","triggerScenarios":"`spacetime server edit <server> --nickname <new_nick>` where <new_nick> equals any other configured server's nickname or host (find_server(new_nick) succeeds on a different entry).","commonSituations":"Renaming a second entry to a conventional label like 'mainnet', 'testnet' or 'local' when one already uses it; copy-pasting server blocks between machines; renaming during a migration to find the old name taken.","solutions":["Choose a nickname that no other server uses as nickname or host (`spacetime server list` shows current entries)","If the old label is the one you want, rename or remove the colliding server first, then retry","Address servers by their existing nick_or_host instead of renaming"],"exampleFix":"# before (fails: 'mainnet' already identifies another entry)\nspacetime server edit testnet-edge --nickname mainnet\n\n# after\nspacetime server edit testnet-edge --nickname mainnet-eu","handlingStrategy":"validation","validationCode":"# Derive a nickname guaranteed not to collide before renaming\nNEW_NICK=\"prod-eu\"\nif ! spacetime server list | grep -q \"^${NEW_NICK}\\b\\| ${NEW_NICK}\\b\"; then\n  spacetime server edit prod --nickname \"$NEW_NICK\"\nfi","typeGuard":null,"tryCatchPattern":"match config.edit_server(server, Some(new_nick), None, None) {\n    Ok(res) => res,\n    Err(e) if e.to_string().starts_with(\"Nickname\") && e.to_string().contains(\"conflicts with saved configuration\") => {\n        // pick another name or rename the colliding entry first\n        return Err(e);\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Check `spacetime server list` for existing nicknames AND hosts before choosing a new nickname","Use environment-prefixed names (prod-eu, staging-2) instead of generic labels that are likely taken"],"tags":["spacetimedb","cli","server-config","naming-conflict"],"backgroundTag":"config-name-conflict","analyzedSha":"524b4487d949b61a07d4f39c862d1290259dfd20","analyzedAt":"2026-08-16T23:58:54.611Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}