{"record":{"id":"6cf44aa82e451fd0","repo":"linera-io/linera-protocol","slug":"the-uri-has-already-been-assigned","errorCode":null,"errorMessage":"The uri has already been assigned","messagePattern":"The uri has already been assigned","errorType":"validation","errorClass":"anyhow","httpStatus":null,"severity":"error","filePath":"linera-storage-runtime/src/storage_config.rs","lineNumber":199,"sourceCode":"            let parse_error: &'static str = \"Correct format is tcp:db_hostname:port.\";\n            if !s.is_empty() {\n                let mut parts = s.split(':');\n                while let Some(part) = parts.next() {\n                    match part {\n                        \"tcp\" => {\n                            let address = parts.next().ok_or_else(|| {\n                                anyhow!(\"Failed to find address for {s}. {parse_error}\")\n                            })?;\n                            let port_str = parts.next().ok_or_else(|| {\n                                anyhow!(\"Failed to find port for {s}. {parse_error}\")\n                            })?;\n                            let port = NonZeroU16::from_str(port_str).map_err(|_| {\n                                anyhow!(\n                                    \"Failed to find parse port {port_str} for {s}. {parse_error}\",\n                                )\n                            })?;\n                            if uri.is_some() {\n                                bail!(\"The uri has already been assigned\");\n                            }\n                            uri = Some(format!(\"{address}:{port}\"));\n                        }\n                        _ if part.starts_with(\"table\") => {\n                            if namespace.is_some() {\n                                bail!(\"The namespace has already been assigned\");\n                            }\n                            namespace = Some(part.to_string());\n                        }\n                        _ => {\n                            bail!(\"the entry \\\"{part}\\\" is not matching\");\n                        }\n                    }\n                }\n            }\n            let uri = uri.unwrap_or_else(|| \"localhost:9042\".to_string());\n            let namespace = namespace.unwrap_or_else(|| DEFAULT_NAMESPACE.to_string());\n            let inner_storage_config = InnerStorageConfig::ScyllaDb { uri };","sourceCodeStart":181,"sourceCodeEnd":217,"githubUrl":"https://github.com/linera-io/linera-protocol/blob/6c226ddcb332ef55118dc8d0aafbd093d5420899/linera-storage-runtime/src/storage_config.rs#L181-L217","documentation":"Raised while parsing a `scylladb:` storage configuration in `StorageConfig::from_str` (linera-storage-runtime, scylladb feature). The parser loops over the segments and assigns the URI from the (single) `tcp` entry; encountering a second `tcp`-prefixed entry means the URI was already set, which is rejected. Correct form: `scylladb:[tcp:host:port:]table_<namespace>` with at most one tcp entry (defaults to localhost:9042).","triggerScenarios":"Passing `scylladb:tcp:host1:9042:tcp:host2:9042:table_ns` — two tcp entries in one config string.","commonSituations":"Script loops or YAML anchors duplicating the tcp segment when composing the storage string; copy-paste merging two scylladb configs.","solutions":["Keep only one `tcp:host:port` entry and delete the duplicate","If no custom host is needed, omit the tcp entry entirely — localhost:9042 is the default"],"exampleFix":"# before\n--storage scylladb:tcp:10.0.0.1:9042:tcp:10.0.0.2:9042:table_ns\n\n# after\n--storage scylladb:tcp:10.0.0.1:9042:table_ns","handlingStrategy":"validation","validationCode":"// Rust: reject duplicate tcp entries in a scylladb string before FromStr\nif let Some(rest) = storage_str.strip_prefix(\"scylladb:\") {\n    let tcp_count = rest.split(':').filter(|p| *p == \"tcp\").count();\n    anyhow::ensure!(tcp_count <= 1, \"scylladb config allows at most one tcp entry\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Specify tcp:host:port at most once; omit it entirely to get localhost:9042","Avoid concatenating config fragments that each carry their own tcp entry"],"tags":["config","parsing","scylladb","linera-storage"],"backgroundTag":"duplicate-config-key","analyzedSha":"6c226ddcb332ef55118dc8d0aafbd093d5420899","analyzedAt":"2026-08-22T22:49:09.787Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}