{"record":{"id":"a175d95d09004541","repo":"influxdata/influxdb","slug":"error-decoding-params-from-url-0","errorCode":null,"errorMessage":"error decoding params from url: {0}","messagePattern":"error decoding params from url: (.+?)","errorType":"http","errorClass":"Error::SerdeUrlDecoding","httpStatus":null,"severity":"error","filePath":"core/iox_v1_query_api/src/error.rs","lineNumber":42,"sourceCode":"\n    #[error(\"invalid mime type ({0})\")]\n    InvalidMimeType(String),\n\n    /// Missing parameters for query\n    #[error(\"missing query parameters 'db' and 'q'\")]\n    MissingQueryParams,\n\n    #[error(\"error decoding multipart file upload: {0}\")]\n    MultipartFile(String),\n\n    #[error(\"Invalid UTF8: {message} {error}\")]\n    Utf8 {\n        message: &'static str,\n        error: String,\n    },\n\n    /// Serde decode error\n    #[error(\"error decoding params from url: {0}\")]\n    SerdeUrlDecoding(#[from] serde_urlencoded::de::Error),\n\n    // SerdeJsonError\n    #[error(\"error decoding query body: {0}\")]\n    SerdeJson(#[from] serde_json::Error),\n\n    #[error(\"datafusion error: {0}\")]\n    Datafusion(#[from] DataFusionError),\n\n    #[error(\"error in InfluxQL statement: {0}\")]\n    InfluxqlRewrite(#[from] rewrite::Error),\n\n    #[error(\"must provide only one InfluxQl statement per query\")]\n    InfluxqlSingleStatement,\n\n    #[error(\"must specify a 'db' parameter, or provide the database in the InfluxQL query\")]\n    InfluxqlNoDatabase,\n","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/core/iox_v1_query_api/src/error.rs#L24-L60","documentation":"`Error::SerdeUrlDecoding` wraps `serde_urlencoded::de::Error` and is thrown when URL-encoded request parameters (query string or form body) cannot be deserialized into the expected parameter struct. It is auto-converted via `#[from]`, so any form/query decode failure in the handler surfaces with this message.","triggerScenarios":"GET /query with a malformed query string (bad percent-encoding, invalid UTF-8 escapes, duplicate/unsupported keys), or POST with a urlencoded body that fails to deserialize.","commonSituations":"Clients that do not percent-encode special characters (`&`, `=`, `+`, spaces) inside parameter values, hand-concatenated URLs, or parameter names that changed between API versions.","solutions":["URL-encode all parameter values (use the client's query/form builder instead of string concatenation).","Check the query string parses: run `serde_urlencoded::from_str` on it locally to reproduce.","Verify parameter names match the current API contract."],"exampleFix":"// before\nlet url = format!(\"/query?db={}&q={}\", db, q); // unencoded\n// after\nlet url = Url::parse_with_params(\"http://host/query\", &[(\"db\", db), (\"q\", q)])?;","handlingStrategy":"validation","validationCode":"use url::Url;\nfn build_query_url(base: &str, db: &str, q: &str) -> Result<String, url::ParseError> {\n    Ok(Url::parse_with_params(base, &[(\"db\", db), (\"q\", q)])?.into())\n}","typeGuard":"fn is_serde_url_error(e: &iox_v1_query_api::Error) -> bool {\n    matches!(e, iox_v1_query_api::Error::SerdeUrlDecoding(_))\n}","tryCatchPattern":"match api.query_urlencoded(&params).await {\n    Err(e) if is_serde_url_error(&e) => eprintln!(\"malformed query string: {e}\"),\n    other => other,\n}","preventionTips":["Always use a URL builder (Url::parse_with_params, reqwest .query()) instead of string concatenation.","Percent-encode user-derived values even if they 'look safe'.","Round-trip test: encode then decode the query string locally before shipping."],"tags":["rust","http-api","urlencoded","deserialization","serde","thiserror"],"backgroundTag":"invalid-url-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"}