{"record":{"id":"387fe57fdc54b0f6","repo":"influxdata/influxdb","slug":"invlid-utf8-received-from-server-0","errorCode":null,"errorMessage":"invlid UTF8 received from server: {0}","messagePattern":"invlid UTF8 received from server: (.+?)","errorType":"error_code","errorClass":"Error::Utf8","httpStatus":null,"severity":"error","filePath":"influxdb3_commands/src/query.rs","lineNumber":22,"sourceCode":"use clap::{Parser, ValueEnum};\nuse std::fs;\nuse std::io::{BufReader, IsTerminal, Read, stdin};\nuse tokio::{\n    fs::OpenOptions,\n    io::{self, AsyncWriteExt},\n};\nuse url::Url;\n\nuse crate::common::Format;\n\nuse super::common::InfluxDb3Config;\n\n#[derive(Debug, thiserror::Error)]\npub enum Error {\n    #[error(transparent)]\n    Client(#[from] influxdb3_client::Error),\n\n    #[error(\"invlid UTF8 received from server: {0}\")]\n    Utf8(#[from] Utf8Error),\n\n    #[error(\"io error: {0}\")]\n    Io(#[from] io::Error),\n\n    #[error(\"cannot write parquet to a terminal, use `--output <file>` or pipe the output\")]\n    NoOutputFileForParquet,\n    #[error(\n        \"No input from stdin detected, no string was passed in,  and no file \\\n        path was given\"\n    )]\n    NoInput,\n}\n\npub type Result<T> = std::result::Result<T, Error>;\n\n#[derive(Debug, Parser)]\n#[clap(visible_alias = \"q\")]","sourceCodeStart":4,"sourceCodeEnd":40,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/influxdb3_commands/src/query.rs#L4-L40","documentation":"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').","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before: pointing CLI at a proxy port returning binary bodies\nlet client = Client::new(\"http://proxy.internal:8081\", token);\n// after: use the InfluxDB 3 HTTP endpoint directly\nlet client = Client::new(\"http://influxdb3.internal:8181\", token);","handlingStrategy":"try-catch","validationCode":"// verify endpoint returns an InfluxDB HTTP response before querying\nlet resp = reqwest::get(format!(\"{url}/health\")).await?;\nlet ct = resp.headers().get(\"content-type\").and_then(|v| v.to_str().ok()).unwrap_or(\"\");\nif ct.contains(\"json\") || resp.status().is_success() { /* proceed */ }","typeGuard":"fn is_utf8_error(e: &influxdb3_commands::query::Error) -> bool {\n    matches!(e, influxdb3_commands::query::Error::Utf8(_))\n}","tryCatchPattern":"match query_cmd().await {\n    Err(influxdb3_commands::query::Error::Utf8(e)) => {\n        eprintln!(\"server returned non-UTF-8 bytes: {e}; check proxy/data encoding\");\n    }\n    other => other?,\n}","preventionTips":["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."],"tags":["encoding","utf8","query","rust"],"backgroundTag":"unexpected-response-shape","analyzedSha":"06200ef96ba82c5f6727e5038a83af8e722c6875","analyzedAt":"2026-09-19T12:55:30.003Z","contentChangedAt":"2026-09-19T12:55:30.003Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}