{"record":{"id":"a1f3169eb0949716","repo":"influxdata/influxdb","slug":"transparent-v2writeparseerror","errorCode":null,"errorMessage":"<transparent: V2WriteParseError>","messagePattern":"<transparent: V2WriteParseError>","errorType":"exception","errorClass":"MultiTenantExtractError","httpStatus":null,"severity":"error","filePath":"core/iox_http/src/write/multi_tenant.rs","lineNumber":23,"sourceCode":"\nuse async_trait::async_trait;\nuse data_types::{NamespaceName, OrgBucketMappingError};\nuse iox_http_util::Request;\n\nuse super::{\n    WriteParams, WriteParseError, WriteRequestUnifier,\n    v2::{V2WriteParseError, WriteParamsV2},\n};\n\n/// Request parsing errors when operating in \"single tenant\" mode.\n#[derive(Debug, thiserror::Error)]\npub enum MultiTenantExtractError {\n    /// A failure to map a org & bucket to a reasonable [`NamespaceName`].\n    #[error(transparent)]\n    InvalidOrgAndBucket(#[from] OrgBucketMappingError),\n\n    /// A [`WriteParamsV2`] failed to be parsed from the HTTP request.\n    #[error(transparent)]\n    ParseV2Request(#[from] V2WriteParseError),\n}\n\n/// Implement a by-ref conversion to avoid \"moving\" the inner errors when only\n/// matching against the variants is necessary (the actual error content is\n/// discarded, replaced with only a HTTP code)\nimpl From<&MultiTenantExtractError> for hyper::StatusCode {\n    fn from(value: &MultiTenantExtractError) -> Self {\n        // Exhaustively match the inner parser errors to ensure new additions\n        // have to be explicitly mapped and are not accidentally mapped to a\n        // \"catch all\" code.\n        match value {\n            MultiTenantExtractError::InvalidOrgAndBucket(_) => Self::BAD_REQUEST,\n            MultiTenantExtractError::ParseV2Request(\n                V2WriteParseError::NoQueryParams | V2WriteParseError::DecodeFail(_),\n            ) => Self::BAD_REQUEST,\n        }\n    }","sourceCodeStart":5,"sourceCodeEnd":41,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/core/iox_http/src/write/multi_tenant.rs#L5-L41","documentation":"This is a transparent wrapper in MultiTenantExtractError for V2WriteParseError. It occurs when a WriteParamsV2 payload fails to be parsed from the multi-tenant HTTP write request. The display output is entirely the inner error's message.","triggerScenarios":"POSTing to the v2 write endpoint with a body/headers that do not deserialize into WriteParamsV2 (missing precision, malformed encoding header, invalid body).","commonSituations":"SDK/server version mismatch on the v2 write protocol; clients sending v1-style bodies to v2 endpoints; wrong Content-Encoding headers.","solutions":["Read the inner V2WriteParseError message for the exact parse failure.","Ensure the request matches the v2 write API contract (correct headers and body format).","Check client and server versions for protocol compatibility.","Validate the payload shape before sending (org, bucket, precision, encoding)."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Rust: validate v2 write payload fields before sending\nfn v2_params_valid(org: &str, bucket: &str, precision: &str, encoding: &str) -> bool {\n    !org.is_empty() && !bucket.is_empty()\n        && matches!(precision, \"ns\" | \"us\" | \"ms\" | \"s\")\n        && matches!(encoding, \"utf-8\" | \"gzip\" | \"identity\")\n}","typeGuard":"fn is_v2_parse_err(e: &MultiTenantExtractError) -> bool {\n    matches!(e, MultiTenantExtractError::ParseV2Request(_))\n}","tryCatchPattern":null,"preventionTips":["Match the v2 write API contract exactly (headers, body, precision)","Keep client SDK and server protocol versions in sync","Validate payloads against the v2 schema before posting"],"tags":["http","write","parse","multi-tenant"],"backgroundTag":"schema-validation-failed","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"}