{"record":{"id":"e423475141dc91ce","repo":"clockworklabs/SpacetimeDB","slug":"invalid-url-new-url","errorCode":null,"errorMessage":"Invalid url: {new_url}","messagePattern":"Invalid url: (.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/cli/src/subcommands/server.rs","lineNumber":316,"sourceCode":"        err => {\n            println!(\"Server could not be reached ({err}): {url}\");\n        }\n    }\n    Ok(())\n}\n\npub async fn exec_edit(mut config: Config, args: &ArgMatches) -> Result<(), anyhow::Error> {\n    let server = args.get_one::<String>(\"server\").unwrap().as_str();\n\n    let old_url = config.get_host_url(Some(server))?;\n\n    let new_nick = args.get_one::<String>(\"nickname\").map(|s| s.as_str());\n    let new_url = args.get_one::<String>(\"url\").map(|s| s.as_str());\n    let (new_host, new_proto) = match new_url {\n        None => (None, None),\n        Some(new_url) => {\n            let (new_host, new_proto) = host_or_url_to_host_and_protocol(new_url);\n            let new_proto = new_proto.ok_or_else(|| anyhow::anyhow!(\"Invalid url: {new_url}\"))?;\n            (Some(new_host), Some(new_proto))\n        }\n    };\n\n    let no_fingerprint = args.get_flag(\"no-fingerprint\");\n    let force = args.get_flag(\"force\");\n\n    if let Some(new_proto) = new_proto {\n        valid_protocol_or_error(new_proto)?;\n    }\n\n    let (old_nick, old_host, old_proto) = config.edit_server(server, new_nick, new_host, new_proto)?;\n    let server = new_nick.unwrap_or(server);\n\n    if let (Some(new_nick), Some(old_nick)) = (new_nick, old_nick) {\n        println!(\"Changing nickname from {old_nick} to {new_nick}\");\n    }\n    if let (Some(new_host), Some(old_host)) = (new_host, old_host) {","sourceCodeStart":298,"sourceCodeEnd":334,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/524b4487d949b61a07d4f39c862d1290259dfd20/crates/cli/src/subcommands/server.rs#L298-L334","documentation":"`spacetime server edit --url <new_url>` parses the new URL with `host_or_url_to_host_and_protocol`. When the string contains no `://`, the protocol is `None` and the CLI bails with 'Invalid url: {new_url}' before touching config. This differs from `server add`, which has its own check; here the error fires directly in `exec_edit`'s match on the optional `--url` value.","triggerScenarios":"Editing a server with a scheme-less URL, e.g. `spacetime server edit myserver --url mainnet.spacetimedb.com`, or a pasted URL whose `://` got mangled.","commonSituations":"Renaming a server's host without re-typing the scheme; shell history editing that truncates the URL; scripting the edit with a bare hostname variable.","solutions":["Include the scheme: `--url https://mainnet.spacetimedb.com`","Quote the argument and echo it first to confirm the exact string contains `://`","Alternatively remove and re-add the server with a full URL if editing keeps failing"],"exampleFix":"# before\nspacetime server edit testnet --url testnet.spacetimedb.com\n# after\nspacetime server edit testnet --url https://testnet.spacetimedb.com","handlingStrategy":"validation","validationCode":"# Validate the edit target URL has a scheme\ncase \"$url\" in http://*|https://*) ;; *) echo \"invalid url: $url\"; exit 2;; esac\nspacetime server edit \"$srv\" --url \"$url\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep canonical full URLs in one place and pass them verbatim to edit/add","Prefer remove + add with a known-good URL when unsure"],"tags":["spacetimedb","server-config","url-validation","edit"],"backgroundTag":"invalid-url-format","analyzedSha":"524b4487d949b61a07d4f39c862d1290259dfd20","analyzedAt":"2026-08-16T23:58:54.611Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}