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
- Verify the server URL/port points at the actual InfluxDB 3 HTTP endpoint, not a proxy or binary service.
- Check that data written to the server is valid UTF-8 (tags/fields); sanitize or re-ingest offending records.
- Bypass intermediaries (disable compression/transform in the proxy) and retry the query directly.
- Fetch the same query with curl and inspect the raw body bytes to identify the source of the invalid data.
- 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
- Ensure all ingested data (tags/fields) is valid UTF-8.
- Point the CLI directly at the InfluxDB HTTP port, not an intermediary returning binary bodies.
- Disable proxy content-transformations (gzip re-encoding) for query paths.
- Use parquet output for binary-safe retrieval of large results.
- Probe the endpoint with curl and check the raw body when decoding errors appear.
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
- Invalid UTF8
- body content is not valid utf8
- Cannot query: (query: )
- invalid UTF8 in response
- queries not supported in compactor only mode
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)