{"record":{"id":"c94583a96018d361","repo":"apache/iceberg","slug":"suppressing-exception-in-catch-c94583","errorCode":null,"errorMessage":"Suppressing exception in catch: {}","messagePattern":"Suppressing exception in catch: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"flink/v2.2/flink/src/main/java/org/apache/iceberg/flink/source/RowDataRewriter.java","lineNumber":154,"sourceCode":"    public List<DataFile> map(CombinedScanTask task) throws Exception {\n      // Initialize the task writer.\n      this.writer = taskWriterFactory.create();\n      try (DataIterator<RowData> iterator =\n          new DataIterator<>(rowDataReader, task, io, encryptionManager)) {\n        while (iterator.hasNext()) {\n          RowData rowData = iterator.next();\n          writer.write(rowData);\n        }\n        return Lists.newArrayList(writer.dataFiles());\n      } catch (Throwable originalThrowable) {\n        try {\n          LOG.error(\"Aborting commit for  (subTaskId {}, attemptId {})\", subTaskId, attemptId);\n          writer.abort();\n          LOG.error(\"Aborted commit for  (subTaskId {}, attemptId {})\", subTaskId, attemptId);\n        } catch (Throwable inner) {\n          if (originalThrowable != inner) {\n            originalThrowable.addSuppressed(inner);\n            LOG.warn(\"Suppressing exception in catch: {}\", inner.getMessage(), inner);\n          }\n        }\n\n        if (originalThrowable instanceof Exception) {\n          throw originalThrowable;\n        } else {\n          throw new RuntimeException(originalThrowable);\n        }\n      }\n    }\n  }\n}\n","sourceCodeStart":136,"sourceCodeEnd":167,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/flink/v2.2/flink/src/main/java/org/apache/iceberg/flink/source/RowDataRewriter.java#L136-L167","documentation":"A warning logged in RowDataRewriter.map's cleanup path: after the original throwable occurred during commit, closing/aborting the writer also threw, and the secondary exception is attached via addSuppressed and logged. The original exception is still rethrown afterwards.","triggerScenarios":"Any Throwable thrown while aborting writers during commit failure handling (writer.abort() in the catch block of map), when the inner throwable is not the same object as the original.","commonSituations":"FileIO/network errors while cleaning up data files after a failed commit; two failures in quick succession (e.g. commit fails due to commit-state exception, abort fails due to S3 connectivity).","solutions":["Inspect the suppressed exception logged with this message to find the secondary root cause (often fileIO or network)","Fix the original exception first — it is the primary failure and is rethrown","Verify storage credentials/permissions so abort/delete cleanup succeeds"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  writer.abort();\n} catch (Throwable inner) {\n  if (original != inner) original.addSuppressed(inner);\n}","preventionTips":["Fix the primary commit exception; the suppressed one is secondary cleanup failure","Ensure FileIO connectivity/credentials are healthy so abort paths succeed"],"tags":["flink","exception-handling","suppressed-exception","cleanup"],"backgroundTag":"suppressed-exception-during-cleanup","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}