{"record":{"id":"90eb9c5f81f9fbec","repo":"influxdata/influxdb","slug":"invalid-namespace-name-0","errorCode":null,"errorMessage":"invalid namespace name: {0}","messagePattern":"invalid namespace name: (.+?)","errorType":"validation","errorClass":"OrgBucketMappingError","httpStatus":null,"severity":"error","filePath":"core/data_types/src/namespace_name.rs","lineNumber":23,"sourceCode":"/// Length constraints for a [`NamespaceName`] name.\n///\n/// A `RangeInclusive` is a closed interval, covering [1, 64]\nconst LENGTH_CONSTRAINT: RangeInclusive<usize> = 1..=64;\n\n/// Allowlist of chars for a [`NamespaceName`] name.\n///\n/// '/' | '_' | '-' are utilized by the platforms.\nfn is_allowed(c: char) -> bool {\n    c.is_alphanumeric() || matches!(c, '/' | '_' | '-')\n}\n\n/// Errors returned when attempting to construct a [`NamespaceName`] from an org\n/// & bucket string pair.\n#[derive(Debug, Error)]\npub enum OrgBucketMappingError {\n    /// An error returned when the org, or bucket string contains invalid\n    /// characters.\n    #[error(\"invalid namespace name: {0}\")]\n    InvalidNamespaceName(#[from] NamespaceNameError),\n\n    /// Either the org, or bucket is an empty string.\n    #[error(\"missing org/bucket value\")]\n    NoOrgBucketSpecified,\n}\n\n/// [`NamespaceName`] name validation errors.\n#[derive(Debug, Error)]\npub enum NamespaceNameError {\n    /// The provided namespace name does not fall within the valid length of a\n    /// namespace.\n    #[error(\n        \"namespace name {} length must be between {} and {} characters\",\n        name,\n        LENGTH_CONSTRAINT.start(),\n        LENGTH_CONSTRAINT.end()\n    )]","sourceCodeStart":5,"sourceCodeEnd":41,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/core/data_types/src/namespace_name.rs#L5-L41","documentation":"OrgBucketMappingError::InvalidNamespaceName is returned when converting an org/bucket string pair into a NamespaceName fails because one of the strings violates namespace name validation rules. The underlying NamespaceNameError (from the #[from] conversion) is embedded and displayed as \"invalid namespace name: {0}\". The library throws it because org and bucket identifiers must be valid namespace names to be used as a namespace.","triggerScenarios":"Calling the org/bucket to NamespaceName mapping (e.g. try_from(&str, &str) style constructors) with an org or bucket string that fails NamespaceName validation: too short/long or containing disallowed characters.","commonSituations":"InfluxDB 3.0 users writing to a database name containing characters like '/', ':' or spaces, or an overly long bucket name in the v1 write path where org/bucket map to a namespace.","solutions":["Inspect the embedded NamespaceNameError in the message to see whether it was a length or character problem.","Rename the org/bucket to contain only allowed characters (alphanumeric, '-', '_', etc.) and within the length constraint.","If you cannot change the name, create a valid namespace and map your writes to it instead of using the raw bucket string.","Sanitize/validate org and bucket inputs at your application boundary before calling the library."],"exampleFix":"// before\nlet ns = NamespaceName::from_org_bucket(\"my org\", \"bucket/1\")?; // invalid chars\n// after\nlet ns = NamespaceName::from_org_bucket(\"my-org\", \"bucket-1\")?;","handlingStrategy":"validation","validationCode":"fn is_valid_namespace_name(s: &str) -> bool {\n    !s.is_empty()\n        && (4..=64).contains(&s.len())\n        && s.chars().all(|c| c.is_ascii_alphanumeric() || c == '-' || c == '_')\n}\n// call before: is_valid_namespace_name(org) && is_valid_namespace_name(bucket)","typeGuard":null,"tryCatchPattern":"match NamespaceName::from_org_bucket(org, bucket) {\n    Ok(ns) => use(ns),\n    Err(OrgBucketMappingError::InvalidNamespaceName(e)) => {\n        log::error!(\"org/bucket failed name validation: {e}\");\n        sanitize_and_retry(org, bucket)\n    }\n    Err(e) => return Err(e.into()),\n}","preventionTips":["Restrict org/bucket configuration to alphanumeric, '-' and '_' characters.","Validate names at config-load time, not at write time.","Include the inner NamespaceNameError text when surfacing the failure to users."],"tags":["rust","validation","namespace","influxdb"],"backgroundTag":"invalid-namespace-name","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"}