influxdata/influxdb · error · Error

serde error

Error message

serde error: {0}

What it means

Occurs when the server fails to URL-decode query string parameters (e.g. db, q, precision) using serde_urlencoded. The de::Error is wrapped by #[from], so any malformed form/query payload that cannot deserialize into the endpoint's parameter struct surfaces as this error.

Solutions

  1. Percent-encode query parameter values (spaces as %20, etc.)
  2. Check each parameter's expected type (e.g. epoch/precision must be a known string) and pass a valid value
  3. Remove or fix duplicated parameters and stray '&' or '=' characters in the query string
  4. Use the official InfluxDB client library instead of hand-building URLs

Example fix

// before
GET /query?db=my db&q=SELECT 1   (unencoded space)
// after
GET /query?db=my%20db&q=SELECT%201
Defensive patterns

Strategy: validation

Validate before calling

const qs = new URLSearchParams();
qs.set("db", db);
qs.set("q", query);
const url = base + "?" + qs.toString(); // guarantees valid encoding

Type guard

function isSafeParam(v) { return typeof v === "string" && v.length > 0 && !/[^\w\- .,:*()=@%]/.test(v); }

Try / catch

try { const r = await fetch(url); } catch (e) {
  if (String(e).includes("serde error")) {
    // rebuild query string with URLSearchParams and retry
  }
}

Prevention

When it happens

Trigger: GET/POST requests whose query string or x-www-form-urlencoded body contains values that fail deserialization (wrong types, unparseable numeric params like epoch/precision, malformed percent-encoding).

Common situations: Hand-crafted URLs with special characters not percent-encoded; passing strings where an integer is expected; double-encoding a parameter.

Understand the failure class

Background: "Invalid query parameter" / "Failed to parse value of ...": fixing bad query string parameters across APIs — this error's family across 36 libraries.

Related errors


AI-assisted analysis of influxdata/influxdb@06200ef96b (2026-09-19). Data as JSON: /api/errors/3723fbb47dcf457e. Report an issue: GitHub.

Appendix: source

Thrown at influxdb3_server/src/http.rs:283

    MissingDeleteDatabaseParams,

    /// Missing parameters for query
    #[error("missing query parameters 'db' and 'q'")]
    MissingQueryParams,

    /// Missing the `q` parameter in the v1 /query API
    #[error("missing query parameter 'q'")]
    MissingQueryV1Params,

    /// MIssing parameters for write
    #[error("missing query parameter 'db'")]
    MissingWriteParams,

    #[error("the mime type specified was not valid UTF8: {0}")]
    NonUtf8MimeType(#[from] FromUtf8Error),

    /// Serde decode error
    #[error("serde error: {0}")]
    SerdeUrlDecoding(#[from] serde_urlencoded::de::Error),

    /// Arrow error
    #[error("arrow error: {0}")]
    Arrow(#[from] arrow::error::ArrowError),

    /// Hyper error
    #[error("hyper http error: {0}")]
    Hyper(#[from] hyper::http::Error),

    /// WriteBuffer error
    #[error("write buffer error: {0}")]
    WriteBuffer(#[from] influxdb3_write::write_buffer::Error),

    /// Persister error
    #[error("persister error: {0}")]
    Persister(#[from] influxdb3_write::persister::PersisterError),

View on GitHub (pinned to 06200ef96b)