influxdata/influxdb · error · OrgBucketMappingError

missing org/bucket value

Error message

missing org/bucket value

What it means

OrgBucketMappingError::NoOrgBucketSpecified is returned when either the org or the bucket string is empty while attempting to construct a NamespaceName from the pair. A namespace needs both a non-empty org and bucket component, so the library rejects the empty value up front.

Solutions

  1. Check your client/write URL and ensure both org and bucket (or 'db' param) are supplied and non-empty.
  2. Verify environment variables or config files feeding org/bucket are actually set.
  3. Add an empty-string check on org and bucket before invoking the conversion.
  4. If empty values are expected, use the direct NamespaceName constructor with a single valid name instead of the org/bucket mapping.

Example fix

// before
let ns = NamespaceName::from_org_bucket(&org, &bucket)?; // org may be ""
// after
assert!(!org.is_empty() && !bucket.is_empty(), "org and bucket required");
let ns = NamespaceName::from_org_bucket(&org, &bucket)?;
Defensive patterns

Strategy: validation

Validate before calling

if org.is_empty() || bucket.is_empty() {
    return Err("both org and bucket must be non-empty".into());
}

Try / catch

match NamespaceName::from_org_bucket(org, bucket) {
    Ok(ns) => use(ns),
    Err(OrgBucketMappingError::NoOrgBucketSpecified) => {
        log::error!("org or bucket was empty; check ORG/BUCKET config");
        Err(ConfigError::MissingOrgBucket)
    }
    Err(e) => return Err(e.into()),
}

Prevention

When it happens

Trigger: Calling the org/bucket to NamespaceName conversion with an empty string for either component, e.g. NamespaceName::from_org_bucket("", "bucket") or ("org", "").

Common situations: Misconfigured InfluxDB v1 compatibility writes where the 'db' or 'u'/'p' query parameters are missing, or env-driven configuration where ORG/BUCKET variables resolve to empty strings.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


AI-assisted analysis of influxdata/influxdb@06200ef96b (2026-09-19). Data as JSON: /api/errors/c80c727cb76671a6. Report an issue: GitHub.

Appendix: source

Thrown at core/data_types/src/namespace_name.rs:27

/// Allowlist of chars for a [`NamespaceName`] name.
///
/// '/' | '_' | '-' are utilized by the platforms.
fn is_allowed(c: char) -> bool {
    c.is_alphanumeric() || matches!(c, '/' | '_' | '-')
}

/// Errors returned when attempting to construct a [`NamespaceName`] from an org
/// & bucket string pair.
#[derive(Debug, Error)]
pub enum OrgBucketMappingError {
    /// An error returned when the org, or bucket string contains invalid
    /// characters.
    #[error("invalid namespace name: {0}")]
    InvalidNamespaceName(#[from] NamespaceNameError),

    /// Either the org, or bucket is an empty string.
    #[error("missing org/bucket value")]
    NoOrgBucketSpecified,
}

/// [`NamespaceName`] name validation errors.
#[derive(Debug, Error)]
pub enum NamespaceNameError {
    /// The provided namespace name does not fall within the valid length of a
    /// namespace.
    #[error(
        "namespace name {} length must be between {} and {} characters",
        name,
        LENGTH_CONSTRAINT.start(),
        LENGTH_CONSTRAINT.end()
    )]
    LengthConstraint {
        /// The user-provided namespace that failed validation.
        name: String,
    },

View on GitHub (pinned to 06200ef96b)