influxdata/influxdb · error · Error::Utf8

invlid UTF8 received from server

Error message

invlid UTF8 received from server: {0}

What it means

The Utf8 variant of influxdb3_commands::query::Error, converted via #[from] from a Utf8Error. It means the raw bytes returned by the server (e.g. a parquet or CSV query response body) could not be decoded as UTF-8, so the CLI cannot interpret the response. Note the message contains a typo ('invlid' for 'invalid').

Solutions

  1. Verify the server URL/port points at the actual InfluxDB 3 HTTP endpoint, not a proxy or binary service.
  2. Check that data written to the server is valid UTF-8 (tags/fields); sanitize or re-ingest offending records.
  3. Bypass intermediaries (disable compression/transform in the proxy) and retry the query directly.
  4. Fetch the same query with curl and inspect the raw body bytes to identify the source of the invalid data.
  5. Upgrade the CLI/server — newer versions may handle binary formats (parquet) without UTF-8 decoding.

Example fix

// before: pointing CLI at a proxy port returning binary bodies
let client = Client::new("http://proxy.internal:8081", token);
// after: use the InfluxDB 3 HTTP endpoint directly
let client = Client::new("http://influxdb3.internal:8181", token);
Defensive patterns

Strategy: try-catch

Validate before calling

// verify endpoint returns an InfluxDB HTTP response before querying
let resp = reqwest::get(format!("{url}/health")).await?;
let ct = resp.headers().get("content-type").and_then(|v| v.to_str().ok()).unwrap_or("");
if ct.contains("json") || resp.status().is_success() { /* proceed */ }

Type guard

fn is_utf8_error(e: &influxdb3_commands::query::Error) -> bool {
    matches!(e, influxdb3_commands::query::Error::Utf8(_))
}

Try / catch

match query_cmd().await {
    Err(influxdb3_commands::query::Error::Utf8(e)) => {
        eprintln!("server returned non-UTF-8 bytes: {e}; check proxy/data encoding");
    }
    other => other?,
}

Prevention

When it happens

Trigger: Running a query whose output format decodes bytes as UTF-8 (e.g. formatting CSV/plain text) while the response body contains non-UTF-8 bytes — corrupted response, compressed/binary body treated as text, or a non-InfluxDB service (proxy error page, binary payload) answering the request.

Common situations: Querying through a misconfigured reverse proxy that returns gzip/binary bodies without proper content-negotiation; server-side corruption writing invalid bytes; pointing the CLI at the wrong port where a binary service listens; character-encoding mismatches in data ingested with non-UTF-8 tags.

Related errors


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

Appendix: source

Thrown at influxdb3_commands/src/query.rs:22

use clap::{Parser, ValueEnum};
use std::fs;
use std::io::{BufReader, IsTerminal, Read, stdin};
use tokio::{
    fs::OpenOptions,
    io::{self, AsyncWriteExt},
};
use url::Url;

use crate::common::Format;

use super::common::InfluxDb3Config;

#[derive(Debug, thiserror::Error)]
pub enum Error {
    #[error(transparent)]
    Client(#[from] influxdb3_client::Error),

    #[error("invlid UTF8 received from server: {0}")]
    Utf8(#[from] Utf8Error),

    #[error("io error: {0}")]
    Io(#[from] io::Error),

    #[error("cannot write parquet to a terminal, use `--output <file>` or pipe the output")]
    NoOutputFileForParquet,
    #[error(
        "No input from stdin detected, no string was passed in,  and no file \
        path was given"
    )]
    NoInput,
}

pub type Result<T> = std::result::Result<T, Error>;

#[derive(Debug, Parser)]
#[clap(visible_alias = "q")]

View on GitHub (pinned to 06200ef96b)