influxdata/influxdb · error · Error
Error writing output
Error message
Error writing output: {0} What it means
Error::Write wraps a std::io::Error ([#from]) raised while writing the formatted InfluxQL output to the destination writer. Any I/O failure while streaming the formatted line-protocol bytes — 'Error writing output: {0}' — surfaces as this variant.
Solutions
- Inspect the inner std::io::Error kind (e.g., PermissionDenied, BrokenPipe, UnexpectedEof) and address that root cause
- Check disk space and write permissions on the destination file/directory before formatting
- Handle BrokenPipe gracefully by catching it rather than treating it as a formatter bug
- Retry the operation or write to a different destination (stdout, temp file) after fixing the I/O condition
Example fix
// before
let mut out = std::fs::File::create("/ro/mount/out.lp")?;
formatter.format(&batches, &mut out)?;
// after
let mut out = std::fs::OpenOptions::new()
.write(true)
.create(true)
.open("./out.lp")?; // writable path
formatter.format(&batches, &mut out)?; Defensive patterns
Strategy: try-catch
Validate before calling
// ensure destination is writable before formatting let probe = std::fs::OpenOptions::new().append(true).open(path)?; drop(probe);
Type guard
fn is_write_error(e: &influxql_format::Error) -> bool {
matches!(e, influxql_format::Error::Write(_))
} Try / catch
match formatter.format(&batches, &mut out) {
Err(influxql_format::Error::Write(io)) if io.kind() == std::io::ErrorKind::BrokenPipe => {
// consumer went away; exit quietly
}
other => other?,
} Prevention
- Verify disk space and write permissions for the output destination
- Treat BrokenPipe/EPIPE as normal consumer termination, not a bug
- Prefer stdout or a temp file when piping output to another process
When it happens
Trigger: Calling a format method that takes a writer (e.g., format_to or impl write into a File, TcpStream, or in-memory buffer) when the underlying write fails: disk full, closed pipe, permission denied on the file, or a broken connection to a remote sink.
Common situations: Redirecting formatted output to a file on a full or read-only filesystem; writing to a socket whose peer has disconnected (EPIPE); piping into a downstream process that exited early.
Understand the failure class
Background: "failed to write file", "Could not save figure", "Error saving remote file" — file write failed: causes and fixes across languages and libraries — this error's family across 38 libraries.
Related errors
- Arrow error
- Bind parameter ' ' was provided but not found in the…
- Bind parameter ' ' was referenced in the InfluxQL statement…
- can only perform queries on a single database
- cannot write parquet to a terminal, use `--output
AI-assisted analysis of influxdata/influxdb@06200ef96b (2026-09-19).
Data as JSON: /api/errors/b5bdc2e5e27fc23f.
Report an issue: GitHub.
Appendix: source
Thrown at core/influxdb_iox_client/src/format/influxql.rs:28
use thiserror::Error;
/// Error type for results formatting
#[derive(Debug, Error)]
pub enum Error {
/// Arrow error.
#[error("Arrow error: {}", .0)]
Arrow(ArrowError),
/// [`InfluxQlMetadata`] not found in Arrow schema metadata.
#[error("Missing InfluxQL metadata")]
MissingMetadata,
/// Error deserializing [`InfluxQlMetadata`] from Arrow schema metadata.
#[error("Invalid InfluxQL metadata: {0}")]
InvalidMetadata(#[from] serde_json::Error),
/// Error writing formatted output.
#[error("Error writing output: {0}")]
Write(#[from] std::io::Error),
}
type Result<T, E = Error> = std::result::Result<T, E>;
/// Options for controlling how table borders are rendered.
#[derive(Debug, Default, Clone, Copy)]
pub enum TableBorders {
/// Use ASCII characters.
#[default]
Ascii,
/// Use UNICODE box-drawing characters.
Unicode,
/// Do not render borders.
None,
}
/// Options for the [`write_columnar`] function.
#[derive(Debug, Default, Copy, Clone)]View on GitHub (pinned to 06200ef96b)