{"record":{"id":"e61c5e09035b4b7f","repo":"apache/flink","slug":"could-not-write-record","errorCode":null,"errorMessage":"Could not write Record.","messagePattern":"Could not write Record\\.","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"flink-connectors/flink-hadoop-compatibility/src/main/java/org/apache/flink/api/java/hadoop/mapreduce/HadoopOutputFormat.java","lineNumber":49,"sourceCode":" * @param <K> Key Type\n * @param <V> Value Type\n */\n@Public\npublic class HadoopOutputFormat<K, V> extends HadoopOutputFormatBase<K, V, Tuple2<K, V>> {\n\n    private static final long serialVersionUID = 1L;\n\n    public HadoopOutputFormat(\n            org.apache.hadoop.mapreduce.OutputFormat<K, V> mapreduceOutputFormat, Job job) {\n        super(mapreduceOutputFormat, job);\n    }\n\n    @Override\n    public void writeRecord(Tuple2<K, V> record) throws IOException {\n        try {\n            this.recordWriter.write(record.f0, record.f1);\n        } catch (InterruptedException e) {\n            throw new IOException(\"Could not write Record.\", e);\n        }\n    }\n}\n","sourceCodeStart":31,"sourceCodeEnd":53,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-connectors/flink-hadoop-compatibility/src/main/java/org/apache/flink/api/java/hadoop/mapreduce/HadoopOutputFormat.java#L31-L53","documentation":"Wraps an InterruptedException raised by recordWriter.write(key, value) inside HadoopOutputFormat.writeRecord(). Flink re-throws it as an IOException to satisfy the OutputFormat contract. It indicates the write was interrupted, usually because the task was cancelled or failed, not that the record itself is invalid.","triggerScenarios":"Produced in HadoopOutputFormat.writeRecord() when this.recordWriter.write(record.f0, record.f1) throws InterruptedException — e.g. the task was cancelled/failing during a write, the sink's underlying I/O was interrupted, or a downstream commit/flush blocked and got interrupted.","commonSituations":"Job cancellation mid-write; task failover interrupting the writer; slow output filesystem (HDFS/S3) where a write is interrupted by a timeout; a custom RecordWriter that throws InterruptedException on recoverable conditions.","solutions":["Inspect the wrapped InterruptedException in the logs to identify cancellation or failover as the interrupt source.","Verify the output filesystem (HDFS/S3) is reachable and writable from the TaskManager.","If interruptions recur during heavy writes, check for backpressure and output-commit contention (FileOutputCommitter).","Treat as expected if the job was intentionally cancelled."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    hadoopOutputFormat.writeRecord(record);\n} catch (IOException e) {\n    if (e.getCause() instanceof InterruptedException) {\n        // write interrupted — usually task cancel/fail; do not silently drop the record\n        LOG.warn(\"Output write interrupted; record may be lost\", e);\n        throw e;\n    } else {\n        throw e;\n    }\n}","preventionTips":["Verify the output filesystem is reachable/writable from the TaskManager.","Treat write interruptions as task-lifecycle events, not data errors.","Watch for backpressure and output-committer contention under heavy writes.","Do not swallow interrupted-write IOExceptions — data may be lost."],"tags":["hadoop","mapreduce","output-format","interrupted","record-writer"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}