influxdata/influxdb · error · SingleTenantExtractError::NoBucketSpecified

missing bucket value

Error message

missing bucket value

What it means

SingleTenantExtractError::NoBucketSpecified is raised while parsing a v2 write request in single-tenant mode. In that mode the 'bucket' path/query segment is expected to name the namespace, and an empty string means no bucket was supplied. The library cannot derive a NamespaceName, so it rejects the request.

Solutions

  1. Set the bucket parameter to the target namespace on the v2 write request URL.
  2. Verify the client/SDK configuration actually passes the bucket value rather than an empty default.
  3. If using v1-style writes, call the v1 endpoint where db is supplied instead of bucket.
  4. Handle SingleTenantExtractError::NoBucketSpecified in the request handler and return a 400 with guidance.

Example fix

// before
let url = format!("http://host/api/v2/write?org=myorg&bucket=");
// after
let url = format!("http://host/api/v2/write?org=myorg&bucket=mybucket");
Defensive patterns

Strategy: validation

Validate before calling

if bucket.is_empty() {
    return Err("v2 write requires a non-empty bucket parameter");
}

Try / catch

match res {
    Err(SingleTenantExtractError::NoBucketSpecified) => /* return 400 'bucket is required' */,
    Err(e) => /* map other errors */,
    Ok(v) => v,
}

Prevention

When it happens

Trigger: Sending an HTTP write request to the v2 (/api/v2/write) endpoint in single-tenant mode with an empty bucket value (e.g. POST /write?org=x&bucket= or missing bucket entirely).

Common situations: Clients configured for v2 writes without setting the bucket field; ported scripts from v1 where only db/rp were used; reverse proxies stripping the bucket query parameter; SDKs where the bucket config value defaults to "".

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/8a11267052b2d1b7. Report an issue: GitHub.

Appendix: source

Thrown at core/iox_http/src/write/single_tenant/mod.rs:33

use auth::authorize;
use authz::{self, Authorizer};
use data_types::{NamespaceName, NamespaceNameError};
use iox_http_util::Request;
use thiserror::Error;

use crate::write::v1::V1_NAMESPACE_RP_SEPARATOR;

use super::{
    WriteParams, WriteParseError, WriteRequestUnifier,
    v1::{RetentionPolicy, V1WriteParseError, WriteParamsV1},
    v2::{V2WriteParseError, WriteParamsV2},
};

/// Request parsing errors when operating in "single tenant" mode.
#[derive(Debug, Error)]
pub enum SingleTenantExtractError {
    /// v2 bucket is an empty string.
    #[error("missing bucket value")]
    NoBucketSpecified,

    /// The namespace (or "db" for V1) is not valid.
    #[error(transparent)]
    InvalidNamespace(#[from] NamespaceNameError),

    /// A [`WriteParamsV1`] failed to be parsed from the HTTP request.
    #[error(transparent)]
    ParseV1Request(#[from] V1WriteParseError),

    /// A [`WriteParamsV2`] failed to be parsed from the HTTP request.
    #[error(transparent)]
    ParseV2Request(#[from] V2WriteParseError),

    /// An error occurred verifying the authorization token.
    #[error(transparent)]
    Authorizer(authz::Error),
}

View on GitHub (pinned to 06200ef96b)