{"record":{"id":"d735704b3f6220c8","repo":"apache/iceberg","slug":"suppressing-exception-in-catch","errorCode":null,"errorMessage":"Suppressing exception in catch: {}","messagePattern":"Suppressing exception in catch: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"flink/v1.20/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/v1.20/flink/src/main/java/org/apache/iceberg/flink/source/RowDataRewriter.java#L136-L167","documentation":"RowDataRewriter.map(), when a commit fails, aborts the writer and then rethrows the original Throwable. If abort() itself throws, the abort exception is added as suppressed to the original and logged with this warning so it doesn't mask the real failure.","triggerScenarios":"A writer commit throws; the subsequent writer.abort() in the catch block also throws (e.g. failure closing/cleaning up files), triggering the suppression log before the original error is rethrown.","commonSituations":"Failure during data-file cleanup after a commit error — e.g. FileIO errors deleting partially written files, or closing an already-broken writer.","solutions":["Inspect the 'Caused by' / suppressed exceptions in the logs alongside the original failure to find the abort-time root cause.","Fix the original commit failure (the primary error is the one rethrown, not this suppressed one).","Verify storage/permissions so abort-time file cleanup succeeds."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  writer.commit();\n} catch (Throwable t) {\n  // inspect t and its suppressed exceptions for the abort-time failure\n  LOG.error(\"Commit failed with {} suppressed exceptions\", t.getSuppressed().length, t);\n  throw t;\n}","preventionTips":["Always read the primary exception, not just the last one logged.","Ensure the FileIO has delete permissions so abort cleanup succeeds.","Monitor commit failure rates on the writer operator."],"tags":["flink","error-handling","suppressed-exception","writer"],"backgroundTag":"file-write-failed","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}