influxdata/influxdb · error · Error
More than one '_'
Error message
More than one '_'
What it means
split_namespace enforces that the namespace string contains exactly one '_' separator. If the iterator still yields another segment after extracting org_id and bucket_id, the string had multiple underscores (e.g. "a_b_c") and this error is thrown, because org or bucket ids cannot contain underscores under this encoding.
Solutions
- Use namespace strings with exactly one underscore: '<org_id>_<bucket_id>' where neither id contains '_'
- Rename org/bucket identifiers to exclude underscores, or use a different delimiter/encoding if the scheme allows
- Pre-validate with a check that s.match_indices('_').count() == 1 before calling
Example fix
// before
let (org, bucket) = split_namespace("my_org_mybucket")?; // two '_'
// after
let (org, bucket) = split_namespace("myorg_mybucket")?; // exactly one '_' Defensive patterns
Strategy: validation
Validate before calling
fn exactly_one_underscore(ns: &str) -> bool {
ns.match_indices('_').count() == 1
} Type guard
fn safe_split(ns: &str) -> Option<(&str, &str)> {
let mut it = ns.split('_');
let org = it.next()?;
let bucket = it.next()?;
it.next().is_none().then(|| (org, bucket))
} Try / catch
match split_namespace(ns) {
Ok((org, bucket)) => /* ... */,
Err(e) if e.to_string().contains("More than one") => eprintln!("namespace '{}' has embedded underscores", ns),
Err(e) => eprintln!("{}", e),
} Prevention
- Enforce that org_id and bucket_id never contain '_' at creation time
- Escape or encode identifiers that may contain underscores before embedding in namespaces
- Add a unit test that round-trips every generated namespace through split_namespace
When it happens
Trigger: Calling split_namespace with strings containing two or more underscores such as "my_org_bucket" or "a_b_c_d"; exercised by tests split_too_many and split_way_too_many.
Common situations: Org or bucket names that themselves contain underscores being joined with '_'; users assuming multi-underscore names are supported; legacy identifiers not migrated to the underscore-free scheme.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
- Could not find '_'
- No bucket_id found
- is not a valid data type, values are int64, uint64…
- Invalid database ID
- invalid namespace name
AI-assisted analysis of influxdata/influxdb@06200ef96b (2026-09-19).
Data as JSON: /api/errors/1aa455b03b9194c9.
Report an issue: GitHub.
Appendix: source
Thrown at core/client_util/src/namespace_translation.rs:40
/// Splits up the namespace name into org_id and bucket_id
pub fn split_namespace(namespace: &str) -> Result<(&str, &str), Error> {
let mut iter = namespace.split('_');
let org_id = iter.next().ok_or_else(|| Error::new(namespace, "empty"))?;
if org_id.is_empty() {
return Err(Error::new(namespace, "No org_id found"));
}
let bucket_id = iter
.next()
.ok_or_else(|| Error::new(namespace, "Could not find '_'"))?;
if bucket_id.is_empty() {
return Err(Error::new(namespace, "No bucket_id found"));
}
if iter.next().is_some() {
return Err(Error::new(namespace, "More than one '_'"));
}
Ok((org_id, bucket_id))
}
#[cfg(test)]
mod test {
use super::*;
#[test]
fn split_good() {
assert_eq!(split_namespace("foo_bar").unwrap(), ("foo", "bar"));
}
#[test]
#[should_panic(expected = "No org_id found")]
fn split_bad_empty() {
split_namespace("").unwrap();View on GitHub (pinned to 06200ef96b)