influxdata/influxdb · error · Error

failed to parse plaintext response

Error message

failed to parse plaintext response: {}

What it means

Error::Text in influxdb3_client::Error, raised when the client expects a plaintext (non-JSON) response body and decoding/processing it via reqwest fails. The reqwest::Error is the #[source]; reqwest_description renders reqwest's detail into the message. Typically the body could not be read as text at the transport layer rather than being bad plaintext content.

Solutions

  1. Inspect the source chain to identify the transport cause (reset vs timeout vs decompression)
  2. Retry the request; this is usually transient connection-level failure
  3. Align Content-Encoding support (enable the matching reqwest compression feature) with the server's encoding
  4. Increase the client timeout if large/slow text responses are being cut off
  5. Check server/proxy logs for connection resets around the failing request

Example fix

// before
let txt = client.some_text_endpoint().await?;
// after
let txt = match client.some_text_endpoint().await {
    Ok(t) => t,
    Err(e @ influxdb3_client::Error::Text(_)) => {
        eprintln!("text response failed: {e:#}");
        return Err(e); // or retry
    }
};
Defensive patterns

Strategy: retry

Validate before calling

// pre-flight: confirm server reachable and encoding supported
// curl -sH 'Accept-Encoding: identity' {base_url}/health

Type guard

fn is_text_parse_error(e: &influxdb3_client::Error) -> bool {
    matches!(e, influxdb3_client::Error::Text(_))
}

Try / catch

match result {
    Err(influxdb3_client::Error::Text(src)) => {
        if is_retryable(&src) { retry_with_backoff(); }
        else { return Err(src.into()); }
    }
    other => other?,
}

Prevention

When it happens

Trigger: Calling endpoints whose response is read as text when the underlying reqwest body read errors out (connection reset mid-body, decompression failure, timeout during body read).

Common situations: Server closes the connection while streaming a text response; gzip/br decompression mismatch between client features and server encoding; idle timeouts cutting off a slow response.

Understand the failure class

Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.

Related errors


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

Appendix: source

Thrown at influxdb3_client/src/lib.rs:53

    RequestSerialization(#[source] serde_json::Error),

    #[error(
        "provided parameter ('{name}') could not be converted \
        to a statment parameter"
    )]
    ConvertQueryParam {
        name: String,
        #[source]
        source: iox_query_params::Error,
    },

    #[error("invalid UTF8 in response: {0}")]
    InvalidUtf8(#[from] FromUtf8Error),

    #[error("failed to parse JSON response: {}", reqwest_description(.0))]
    Json(#[source] reqwest::Error),

    #[error("failed to parse plaintext response: {}", reqwest_description(.0))]
    Text(#[source] reqwest::Error),

    #[error("server responded with error [{code}]: {message}")]
    ApiError {
        code: StatusCode,
        message: String,
        /// Machine-readable error code from JSON error responses, if present.
        error_code: Option<String>,
    },

    #[error("failed to send {method} {url} request: {}", reqwest_description(.source))]
    RequestSend {
        method: Method,
        url: String,
        #[source]
        source: reqwest::Error,
    },

View on GitHub (pinned to 06200ef96b)