{"record":{"id":"ae9f1c013850be3c","repo":"influxdata/influxdb","slug":"failed-to-deserialize-db-rp-precision-in-request-0","errorCode":null,"errorMessage":"failed to deserialize db/rp/precision in request: {0}","messagePattern":"failed to deserialize db/rp/precision in request: (.+?)","errorType":"validation","errorClass":"V1WriteParseError::DecodeFail","httpStatus":null,"severity":"error","filePath":"core/iox_http/src/write/v1.rs","lineNumber":24,"sourceCode":"use iox_http_util::Request;\nuse serde::{Deserialize, Deserializer};\n\nuse super::Precision;\n\n// When a retention policy is provided, it is appended to the db field,\n// separated by a single `/`.\npub const V1_NAMESPACE_RP_SEPARATOR: char = '/';\n\n/// v1 DmlErrors returned when decoding the database / rp information from a\n/// HTTP request and deriving the namespace name from it.\n#[derive(Debug, thiserror::Error)]\npub enum V1WriteParseError {\n    /// The request contains no db destination information.\n    #[error(\"no db destination provided\")]\n    NoQueryParams,\n\n    /// The request contains invalid parameters.\n    #[error(\"failed to deserialize db/rp/precision in request: {0}\")]\n    DecodeFail(#[from] serde::de::value::Error),\n}\n\n/// May be empty string, explicit rp name, or `autogen`. As provided at the\n/// write API. Handling is described in context of the construction of the\n/// `NamespaceName`, and not an explicit honouring for retention duration.\n#[derive(Debug, Default)]\npub enum RetentionPolicy {\n    /// The user did not specify a retention policy (at the write API).\n    #[default]\n    Unspecified,\n    /// Default on v1 database creation, if no rp was provided.\n    Autogen,\n    /// The user specified the name of the retention policy to be used.\n    Named(String),\n}\n\nimpl<'de> Deserialize<'de> for RetentionPolicy {","sourceCodeStart":6,"sourceCodeEnd":42,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/core/iox_http/src/write/v1.rs#L6-L42","documentation":"V1WriteParseError::DecodeFail wraps serde_urlencoded/serde deserialization failures when parsing the db/rp/precision parameters of a v1 write request. It is raised when the parameters are present but malformed (bad format, wrong types, invalid encoding). The source serde error is embedded in the message via {0}.","triggerScenarios":"Sending /write?db=... with a precision value not in the accepted set (s, ms, u/us, ns), or query strings that fail serde_urlencoded deserialization (bad percent-encoding, duplicate malformed keys).","commonSituations":"Typo in precision (e.g. precision=seconds); unescaped special characters in db names; clients writing integer precision codes from other APIs.","solutions":["Read the inner serde error in the message to identify which parameter failed to decode.","Use only accepted precision values: ns, u (or us), ms, s.","Percent-encode db/rp values containing special characters.","Match on V1WriteParseError::DecodeFail(_) to surface a 400 with the underlying decode message."],"exampleFix":"// before\nPOST /write?db=mydb&precision=seconds\n// after\nPOST /write?db=mydb&precision=s","handlingStrategy":"try-catch","validationCode":"const PRECISIONS: [&str; 4] = [\"ns\", \"u\", \"ms\", \"s\"];\nif let Some(p) = precision {\n    assert!(PRECISIONS.contains(&p), \"invalid precision: {p}\");\n}","typeGuard":null,"tryCatchPattern":"match err {\n    V1WriteParseError::DecodeFail(e) => /* 400 with e.to_string() */,\n    other => /* propagate */,\n}","preventionTips":["Whitelist precision values before building the query string.","Percent-encode db/rp values with the url crate.","Test query-string construction with special characters."],"tags":["http","write-api","v1","deserialization","query-params"],"backgroundTag":"invalid-argument-format","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"}