{"record":{"id":"b9690e3193693855","repo":"apache/beam","slug":"failed-closing-channel-to-s","errorCode":null,"errorMessage":"Failed closing channel to %s","messagePattern":"Failed closing channel to (.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"sdks/java/core/src/main/java/org/apache/beam/sdk/io/FileBasedSink.java","lineNumber":1074,"sourceCode":"      } catch (Exception e) {\n        closeChannelAndThrow(channel, outputFile, e);\n      }\n\n      try {\n        finishWrite();\n      } catch (Exception e) {\n        closeChannelAndThrow(channel, outputFile, e);\n      }\n\n      // It is valid for a subclass to either close the channel or not.\n      // They would typically close the channel e.g. if they are wrapping it in another channel\n      // and the wrapper needs to be closed.\n      if (channel.isOpen()) {\n        LOG.debug(\"Closing channel to {}.\", outputFile);\n        try {\n          channel.close();\n        } catch (Exception e) {\n          throw new IOException(String.format(\"Failed closing channel to %s\", outputFile), e);\n        }\n      }\n      LOG.info(\"Successfully wrote temporary file {}\", outputFile);\n    }\n\n    /** Return the WriteOperation that this Writer belongs to. */\n    public WriteOperation<DestinationT, OutputT> getWriteOperation() {\n      return writeOperation;\n    }\n\n    void setDestination(DestinationT destination) {\n      this.destination = destination;\n    }\n\n    /** Return the user destination object for this writer. */\n    public DestinationT getDestination() {\n      return destination;\n    }","sourceCodeStart":1056,"sourceCodeEnd":1092,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/io/FileBasedSink.java#L1056-L1092","documentation":"Writer.close()/finalize output wraps any exception from closing the underlying WritableByteChannel into an IOException 'Failed closing channel to <outputFile>'. This signals the temp output file's channel could not be cleanly closed before the file is committed.","triggerScenarios":"channel.close() throwing while finishing a sink write — underlying filesystem I/O failure, network filesystem (GCS/S3/HDFS) outage, or disk issues during WriteOperation finalization.","commonSituations":"Transient GCS/S3/HDFS connectivity problems during write finalize, disk full, or permissions changes mid-write in distributed runners.","solutions":["Retry the pipeline/job; transient storage outages often resolve.","Check storage backend connectivity, credentials, and quotas for the temp/output locations.","Verify the temporary and output directories are writable by the runner's service account.","Inspect the chained cause 'e' for the underlying I/O error."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { writer.close(); } catch (IOException e) { if (isTransient(e.getCause())) { retryWithBackoff(); } else { throw e; } }","preventionTips":["Monitor storage backend health/quotas before long write jobs.","Ensure temp and output locations share connectivity characteristics.","Use runner-level retry for transient I/O failures."],"tags":["java","apache-beam","io","file-write"],"backgroundTag":"file-write-failed","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}