influxdata/influxdb · error · Error

invalid request

Error message

invalid request: {0}

What it means

Error variant `InvalidRequest(String)` in the ErrorWrite enum in influxdb3_server/src/http.rs. It is a generic catch-all for write-path HTTP requests that fail validation, carrying the specific reason in the message payload.

Solutions

  1. Read the embedded message after 'invalid request: ' to identify the exact validation failure
  2. Validate line protocol and query parameters against the InfluxDB 3 write API docs before sending
  3. Ensure correct Content-Type (e.g. text/plain for line protocol) and escape special characters in measurements/tags

Example fix

// before
curl -X POST 'host/api/v3/write?db=mydb' --data 'm, v=1'
// after: valid line protocol with proper tags
curl -X POST 'host/api/v3/write?db=mydb' -H 'Content-Type: text/plain' --data 'm,t1=a v=1'
Defensive patterns

Strategy: validation

Validate before calling

function validateWriteRequest(lp, contentType) {
  if (typeof lp !== 'string' || lp.trim() === '') throw new Error('empty body');
  if (!/^text\/plain/.test(contentType)) throw new Error('use Content-Type: text/plain for line protocol');
}

Try / catch

try {
  const res = await fetch(writeUrl, {method: 'POST', body: lp});
  if (!res.ok) { const msg = await res.text(); throw new Error(`write rejected: ${msg}`); }
} catch (e) {
  if (String(e.message).startsWith('invalid request:')) { logValidationError(e.message); }
  else throw e;
}

Prevention

When it happens

Trigger: Any write API call (e.g. line-protocol or JSON write endpoints) whose payload fails request-level validation: malformed line protocol, unsupported parameters, bad content-type, or semantic checks in the write handler that produce a reason string.

Common situations: Client SDKs sending line protocol with unescaped special characters; missing or wrong `Content-Type`/`Accept` headers; passing an unsupported query parameter to /write; upgrading server versions introduces new validation the old client does not satisfy.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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

Appendix: source

Thrown at influxdb3_server/src/http.rs:391

    #[error("The following Database does not exist: {0}")]
    MissingDb(String),

    #[error("The following Database Table does not exist: {0}")]
    MissingTable(String),

    #[error("Cannot parse the given human time: {0}")]
    ParsingHumanTime(#[source] humantime::DurationError),

    #[error("Cannot parse the timestamp: {0}")]
    ParsingTimestamp(#[from] chrono::ParseError),

    #[error("Timestamp is out of range")]
    TimestampOutOfRange,

    #[error("Current node mode does not use the processing engine")]
    NoProcessingEngine,

    #[error("invalid request: {0}")]
    InvalidRequest(String),

    #[error(transparent)]
    LegacyWriteParse(#[from] WriteParseError),
}

#[derive(Debug, Error)]
pub(crate) enum AuthenticationError {
    #[error("the request was not authenticated")]
    Unauthenticated,
    #[error(
        "Authorization header was malformed, the request was not in the form of 'Authorization: <auth-scheme> <token>', supported auth-schemes are Bearer, Token and Basic"
    )]
    MalformedRequest,
    #[error("requestor is forbidden from requested resource")]
    Forbidden,
    #[error("to str error: {0}")]
    ToStr(#[from] hyper::header::ToStrError),

View on GitHub (pinned to 06200ef96b)