{"record":{"id":"8b8d68c173dde465","repo":"influxdata/influxdb","slug":"no-bucket-id-found","errorCode":null,"errorMessage":"No bucket_id found","messagePattern":"No bucket_id found","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"core/client_util/src/namespace_translation.rs","lineNumber":36,"sourceCode":"        }\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() {\n        assert_eq!(split_namespace(\"foo_bar\").unwrap(), (\"foo\", \"bar\"));\n    }\n","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/core/client_util/src/namespace_translation.rs#L18-L54","documentation":"split_namespace found an '_' separator but the bucket_id segment it extracted is the empty string. This happens with inputs like \"org_\" where the underscore is present but nothing follows it. The library rejects empty identifiers because they cannot map to a valid bucket.","triggerScenarios":"Calling split_namespace(\"myorg_\") or any string whose characters after the single '_' are empty; also hit by test callers split_bad_empty_bucket_id and split_bad_only_underscore.","commonSituations":"Config or templating that interpolated an empty bucket variable into 'org_{bucket}'; trailing-underscore typos; stripping the bucket name during string manipulation while keeping the separator.","solutions":["Supply a non-empty bucket_id after the underscore in the namespace string","Validate before calling: check the substring after '_' is not empty","Fix template/config interpolation so the bucket placeholder is always populated"],"exampleFix":"// before\nlet (org, bucket) = split_namespace(\"myorg_\")?; // empty bucket_id\n// after\nlet (org, bucket) = split_namespace(\"myorg_mybucket\")?;","handlingStrategy":"validation","validationCode":"fn has_nonempty_bucket(ns: &str) -> bool {\n    ns.split_once('_').map_or(false, |(_, b)| !b.is_empty())\n}","typeGuard":"fn split_checked(ns: &str) -> Option<(&str, &str)> {\n    ns.split_once('_').filter(|(_, b)| !b.is_empty())\n}","tryCatchPattern":"match split_namespace(ns) {\n    Ok((org, bucket)) => /* ... */,\n    Err(e) if e.to_string().contains(\"bucket_id\") => eprintln!(\"bucket segment empty in '{}'\", ns),\n    Err(e) => eprintln!(\"{}\", e),\n}","preventionTips":["Validate bucket_id is non-empty before interpolating into namespace strings","Check templating/config so '{bucket}' placeholders cannot resolve to empty strings","Trim and reject inputs ending with '_'"],"tags":["rust","parsing","namespace","empty-value"],"backgroundTag":"empty-required-field","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"}