{"record":{"id":"b7340c00846986e0","repo":"influxdata/influxdb","slug":"could-not-find","errorCode":null,"errorMessage":"Could not find '_'","messagePattern":"Could not find '_'","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"core/client_util/src/namespace_translation.rs","lineNumber":33,"sourceCode":"        Self::InvalidNamespace {\n            namespace: namespace.into(),\n            reason: reason.into(),\n        }\n    }\n}\n\n/// Splits up the namespace name into org_id and bucket_id\npub fn split_namespace(namespace: &str) -> Result<(&str, &str), Error> {\n    let mut iter = namespace.split('_');\n    let org_id = iter.next().ok_or_else(|| Error::new(namespace, \"empty\"))?;\n\n    if org_id.is_empty() {\n        return Err(Error::new(namespace, \"No org_id found\"));\n    }\n\n    let bucket_id = iter\n        .next()\n        .ok_or_else(|| Error::new(namespace, \"Could not find '_'\"))?;\n\n    if bucket_id.is_empty() {\n        return Err(Error::new(namespace, \"No bucket_id found\"));\n    }\n\n    if iter.next().is_some() {\n        return Err(Error::new(namespace, \"More than one '_'\"));\n    }\n\n    Ok((org_id, bucket_id))\n}\n\n#[cfg(test)]\nmod test {\n    use super::*;\n\n    #[test]\n    fn split_good() {","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/core/client_util/src/namespace_translation.rs#L15-L51","documentation":"split_namespace parses a 'org_id_bucket_id' namespace string into its two components by splitting on '_'. This error is thrown when the iterator is exhausted after extracting the org_id, meaning the string contained no '_' separator (or ended immediately after it), so no bucket_id segment exists. The library requires exactly one underscore separating the two identifiers.","triggerScenarios":"Calling split_namespace with a namespace string that contains no '_' at all (e.g. \"myorg\") or ends with a trailing '_' where the split yields an empty remainder consumed before the empty check can produce a distinct message. Test callers split_bad_only_underscore and similar exercise these paths.","commonSituations":"Passing an unqualified namespace name (just the org or database name) where the API expects the full 'org_bucket' qualified form; string truncation upstream that dropped the suffix after the underscore; hand-built namespace strings in config or tooling missing the bucket segment.","solutions":["Ensure the namespace string is in '<org_id>_<bucket_id>' form with a non-empty bucket_id after the underscore","Validate the format before calling: check the string contains exactly one '_' and that both segments are non-empty","Fix upstream code or configuration that is passing only the org-level identifier instead of the fully qualified namespace"],"exampleFix":"// before\nlet (org, bucket) = split_namespace(\"myorg\")?; // panics/errors: no '_'\n// after\nlet (org, bucket) = split_namespace(\"myorg_mybucket\")?;","handlingStrategy":"validation","validationCode":"fn is_valid_namespace(ns: &str) -> bool {\n    match ns.split_once('_') {\n        Some((org, bucket)) => !org.is_empty() && !bucket.is_empty(),\n        None => false,\n    }\n}","typeGuard":"fn valid_namespace(ns: &str) -> Option<(&str, &str)> {\n    ns.split_once('_').filter(|(o, b)| !o.is_empty() && !b.is_empty())\n}","tryCatchPattern":"match split_namespace(ns) {\n    Ok((org, bucket)) => /* ... */,\n    Err(e) => eprintln!(\"invalid namespace '{}': {}\", ns, e),\n}","preventionTips":["Always build namespace strings with format!(\"{}_{}\", org_id, bucket_id) from typed components instead of concatenating user input","Reject namespaces without an underscore at system boundaries","Never store bare org-level names where a fully qualified namespace is expected"],"tags":["rust","parsing","namespace","invalid-identifier"],"backgroundTag":"invalid-identifier-format","analyzedSha":"06200ef96ba82c5f6727e5038a83af8e722c6875","analyzedAt":"2026-09-19T12:55:30.003Z","contentChangedAt":"2026-09-19T12:55:30.003Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}