{"record":{"id":"b5bdc2e5e27fc23f","repo":"influxdata/influxdb","slug":"error-writing-output-0","errorCode":null,"errorMessage":"Error writing output: {0}","messagePattern":"Error writing output: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"core/influxdb_iox_client/src/format/influxql.rs","lineNumber":28,"sourceCode":"use thiserror::Error;\n\n/// Error type for results formatting\n#[derive(Debug, Error)]\npub enum Error {\n    /// Arrow error.\n    #[error(\"Arrow error: {}\", .0)]\n    Arrow(ArrowError),\n\n    /// [`InfluxQlMetadata`] not found in Arrow schema metadata.\n    #[error(\"Missing InfluxQL metadata\")]\n    MissingMetadata,\n\n    /// Error deserializing [`InfluxQlMetadata`] from Arrow schema metadata.\n    #[error(\"Invalid InfluxQL metadata: {0}\")]\n    InvalidMetadata(#[from] serde_json::Error),\n\n    /// Error writing formatted output.\n    #[error(\"Error writing output: {0}\")]\n    Write(#[from] std::io::Error),\n}\ntype Result<T, E = Error> = std::result::Result<T, E>;\n\n/// Options for controlling how table borders are rendered.\n#[derive(Debug, Default, Clone, Copy)]\npub enum TableBorders {\n    /// Use ASCII characters.\n    #[default]\n    Ascii,\n    /// Use UNICODE box-drawing characters.\n    Unicode,\n    /// Do not render borders.\n    None,\n}\n\n/// Options for the [`write_columnar`] function.\n#[derive(Debug, Default, Copy, Clone)]","sourceCodeStart":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/core/influxdb_iox_client/src/format/influxql.rs#L10-L46","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nlet mut out = std::fs::File::create(\"/ro/mount/out.lp\")?;\nformatter.format(&batches, &mut out)?;\n// after\nlet mut out = std::fs::OpenOptions::new()\n    .write(true)\n    .create(true)\n    .open(\"./out.lp\")?; // writable path\nformatter.format(&batches, &mut out)?;","handlingStrategy":"try-catch","validationCode":"// ensure destination is writable before formatting\nlet probe = std::fs::OpenOptions::new().append(true).open(path)?;\ndrop(probe);","typeGuard":"fn is_write_error(e: &influxql_format::Error) -> bool {\n    matches!(e, influxql_format::Error::Write(_))\n}","tryCatchPattern":"match formatter.format(&batches, &mut out) {\n    Err(influxql_format::Error::Write(io)) if io.kind() == std::io::ErrorKind::BrokenPipe => {\n        // consumer went away; exit quietly\n    }\n    other => other?,\n}","preventionTips":["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"],"tags":["io","output","influxql"],"backgroundTag":"file-write-failed","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"}