{"record":{"id":"9b6714d5f5800674","repo":"databendlabs/databend","slug":"invalid-peer-raft-addr","errorCode":null,"errorMessage":"invalid peer raft addr: {}","messagePattern":"invalid peer raft addr: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/meta/control/src/import.rs","lineNumber":169,"sourceCode":"\n        let id_addrs: Vec<&str> = peer.split('=').collect();\n        if id_addrs.len() != 2 {\n            return Err(anyhow::anyhow!(\"invalid peer str: {}\", peer));\n        }\n        let id = u64::from_str(id_addrs[0])?;\n\n        let addrs: Vec<&str> = id_addrs[1].split(',').collect();\n        if addrs.len() > 2 || addrs.is_empty() {\n            return Err(anyhow::anyhow!(\n                \"require 1 or 2 addresses in peer str: {}\",\n                peer\n            ));\n        }\n        let url = Url::parse(&format!(\"http://{}\", addrs[0]))?;\n        let endpoint = match (url.host_str(), url.port()) {\n            (Some(addr), Some(port)) => Endpoint::new(addr, port),\n            _ => {\n                return Err(anyhow::anyhow!(\"invalid peer raft addr: {}\", addrs[0]));\n            }\n        };\n\n        let node = Node::new(id, endpoint.clone());\n        eprintln!(\"new cluster node:{}\", node);\n\n        nodes.insert(id, node);\n    }\n\n    if nodes.is_empty() {\n        return Ok(nodes);\n    }\n\n    eprintln!(\"new cluster: {:?}\", nodes);\n\n    if !nodes.contains_key(&id) {\n        return Err(anyhow::anyhow!(\n            \"node id ({}) has to be one of cluster member({:?})\",","sourceCodeStart":151,"sourceCodeEnd":187,"githubUrl":"https://github.com/databendlabs/databend/blob/288d84d76e20a2f8f7173bda9691eb6ece301aa9/src/meta/control/src/import.rs#L151-L187","documentation":"metasrv cluster import parses the peer raft address into an http URL to build a grpc Endpoint. If the first address in `addrs` cannot be parsed as host:port (no host or no port), the endpoint cannot be constructed and this error is thrown with the offending address.","triggerScenarios":"Running `metactl` import with a --raft-addr (or peers list) whose first entry lacks a host, lacks a port, or is otherwise malformed (e.g. '127.0.0.1' without ':9191', a hostname with invalid characters).","commonSituations":"Config mistakes when migrating meta data: copy-pasting a node id or address list, forgetting the port, using IPv6 addresses without brackets, or leaving a placeholder value in a script.","solutions":["Check the first entry of the addresses passed to import; ensure it is a valid 'host:port' pair with a numeric port","Fix the address list or CLI flag (e.g. --raft-addr '127.0.0.1:9191') and re-run the import","For IPv6 use bracketed form 'http://[::1]:9191' style input so Url::parse and port extraction succeed","Print/echo the parsed address in your script to confirm what metactl actually received"],"exampleFix":"// before\nmetactl --import --raft-addr 127.0.0.1\n// after\nmetactl --import --raft-addr 127.0.0.1:9191","handlingStrategy":"validation","validationCode":"fn validate_raft_addr(addr: &str) -> Result<(), String> {\n    let url = url::Url::parse(&format!(\"http://{}\", addr))\n        .map_err(|e| format!(\"invalid addr '{}': {}\", addr, e))?;\n    if url.host_str().is_none() || url.port().is_none() {\n        return Err(format!(\"addr '{}' must be host:port\", addr));\n    }\n    Ok(\"\")\n}\n// call before invoking metactl import with --raft-addr","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass raft addrs as explicit host:port pairs","Use bracketed notation for IPv6 addresses","Echo the resolved address in deployment scripts before running import","Keep node address config in one reviewed place to avoid typos"],"tags":["network","address-parsing","metactl"],"backgroundTag":"invalid-url-format","analyzedSha":"288d84d76e20a2f8f7173bda9691eb6ece301aa9","analyzedAt":"2026-09-11T11:29:36.208Z","contentChangedAt":"2026-09-11T11:29:36.208Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}