{"record":{"id":"aa783379348e2195","repo":"apache/iceberg","slug":"failure-during-rewrite-process-for-group","errorCode":null,"errorMessage":"Failure during rewrite process for group {}","messagePattern":"Failure during rewrite process for group (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/actions/RewriteDataFilesSparkAction.java","lineNumber":273,"sourceCode":"    return new RewriteDataFilesCommitManager(\n        table, startingSnapshotId, useStartingSequenceNumber, commitSummary(), branch);\n  }\n\n  private Builder doExecute(\n      FileRewritePlan<FileGroupInfo, FileScanTask, DataFile, RewriteFileGroup> plan,\n      RewriteDataFilesCommitManager commitManager) {\n    ExecutorService rewriteService = rewriteService();\n\n    ConcurrentLinkedQueue<RewriteFileGroup> rewrittenGroups = new ConcurrentLinkedQueue<>();\n\n    Tasks.Builder<RewriteFileGroup> rewriteTaskBuilder =\n        Tasks.foreach(plan.groups())\n            .executeWith(rewriteService)\n            .stopOnFailure()\n            .noRetry()\n            .onFailure(\n                (fileGroup, exception) -> {\n                  LOG.warn(\n                      \"Failure during rewrite process for group {}\", fileGroup.info(), exception);\n                });\n\n    try {\n      rewriteTaskBuilder.run(\n          fileGroup -> {\n            rewrittenGroups.add(rewriteFiles(plan, fileGroup));\n          });\n    } catch (Exception e) {\n      // At least one rewrite group failed, clean up all completed rewrites\n      LOG.error(\n          \"Cannot complete rewrite, {} is not enabled and one of the file set groups failed to \"\n              + \"be rewritten. This error occurred during the writing of new files, not during the commit process. This \"\n              + \"indicates something is wrong that doesn't involve conflicts with other Iceberg operations. Enabling \"\n              + \"{} may help in this case but the root cause should be investigated. Cleaning up {} groups which finished \"\n              + \"being written.\",\n          PARTIAL_PROGRESS_ENABLED,\n          PARTIAL_PROGRESS_ENABLED,","sourceCodeStart":255,"sourceCodeEnd":291,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/actions/RewriteDataFilesSparkAction.java#L255-L291","documentation":"RewriteDataFilesSparkAction executes rewrite tasks per file group with stopOnFailure and no retry; before running, the onFailure callback logs this warning with the group's info and exception. A group whose rewrite task failed is reported here and excluded from the result instead of failing the whole Spark job.","triggerScenarios":"A file-group rewrite task throws during RewriteDataFiles doExecute — e.g. OOM while rewriting large groups, schema/read errors on corrupt data files, or writer failures writing new parquet files.","commonSituations":"Groups with files too large for executor memory (max-file-group-size too high); corrupt or non-readable files written by older writers; executor lost / speculative failures in a busy cluster.","solutions":["Read the attached exception to identify the failing group and root cause (the group info lists its files).","Reduce max-file-group-size / partial-progress.max-commits so groups are smaller and less memory-hungry.","Set rewrite options like partial-progress.enabled true so successful groups still commit despite this group failing.","Fix corrupt source files or exclude them (delete entries) then re-run the rewrite."],"exampleFix":"// before: one huge group fails and aborts rewrite work\nspark.sql(\"CALL catalog.system.rewrite_data_files(table => 'db.t')\");\n// after: enable partial progress and smaller groups\nspark.sql(\"CALL catalog.system.rewrite_data_files(table => 'db.t', \" +\n  \"options => map('partial-progress.enabled','true','max-file-group-size-bytes','1073741824'))\");","handlingStrategy":"validation","validationCode":"spark.sql(\"CALL cat.sys.rewrite_data_files(table => 'db.t', options => map('partial-progress.enabled','true','max-file-group-size-bytes','1073741824'))\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Enable partial-progress so one bad group doesn't discard all rewrite work.","Cap max-file-group-size to sizes executors can handle.","Monitor executor memory; size shuffle partitions appropriately for sorted rewrites.","Investigate group-info file lists in logs to catch corrupt files early."],"tags":["spark","compaction","rewrite-data-files","task-failure"],"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-14T21:17:11.552Z"}