{"record":{"id":"8a11267052b2d1b7","repo":"influxdata/influxdb","slug":"missing-bucket-value","errorCode":null,"errorMessage":"missing bucket value","messagePattern":"missing bucket value","errorType":"validation","errorClass":"SingleTenantExtractError::NoBucketSpecified","httpStatus":null,"severity":"error","filePath":"core/iox_http/src/write/single_tenant/mod.rs","lineNumber":33,"sourceCode":"use auth::authorize;\nuse authz::{self, Authorizer};\nuse data_types::{NamespaceName, NamespaceNameError};\nuse iox_http_util::Request;\nuse thiserror::Error;\n\nuse crate::write::v1::V1_NAMESPACE_RP_SEPARATOR;\n\nuse super::{\n    WriteParams, WriteParseError, WriteRequestUnifier,\n    v1::{RetentionPolicy, V1WriteParseError, WriteParamsV1},\n    v2::{V2WriteParseError, WriteParamsV2},\n};\n\n/// Request parsing errors when operating in \"single tenant\" mode.\n#[derive(Debug, Error)]\npub enum SingleTenantExtractError {\n    /// v2 bucket is an empty string.\n    #[error(\"missing bucket value\")]\n    NoBucketSpecified,\n\n    /// The namespace (or \"db\" for V1) is not valid.\n    #[error(transparent)]\n    InvalidNamespace(#[from] NamespaceNameError),\n\n    /// A [`WriteParamsV1`] failed to be parsed from the HTTP request.\n    #[error(transparent)]\n    ParseV1Request(#[from] V1WriteParseError),\n\n    /// A [`WriteParamsV2`] failed to be parsed from the HTTP request.\n    #[error(transparent)]\n    ParseV2Request(#[from] V2WriteParseError),\n\n    /// An error occurred verifying the authorization token.\n    #[error(transparent)]\n    Authorizer(authz::Error),\n}","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/core/iox_http/src/write/single_tenant/mod.rs#L15-L51","documentation":"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.","triggerScenarios":"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).","commonSituations":"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 \"\".","solutions":["Set the bucket parameter to the target namespace on the v2 write request URL.","Verify the client/SDK configuration actually passes the bucket value rather than an empty default.","If using v1-style writes, call the v1 endpoint where db is supplied instead of bucket.","Handle SingleTenantExtractError::NoBucketSpecified in the request handler and return a 400 with guidance."],"exampleFix":"// before\nlet url = format!(\"http://host/api/v2/write?org=myorg&bucket=\");\n// after\nlet url = format!(\"http://host/api/v2/write?org=myorg&bucket=mybucket\");","handlingStrategy":"validation","validationCode":"if bucket.is_empty() {\n    return Err(\"v2 write requires a non-empty bucket parameter\");\n}","typeGuard":null,"tryCatchPattern":"match res {\n    Err(SingleTenantExtractError::NoBucketSpecified) => /* return 400 'bucket is required' */,\n    Err(e) => /* map other errors */,\n    Ok(v) => v,\n}","preventionTips":["Always include bucket in v2 write URLs and client configs.","Assert configured bucket is non-empty at client startup.","Use SDK builders that enforce required v2 params."],"tags":["http","write-api","single-tenant","validation"],"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"}