{"record":{"id":"7a5ae1d096aa4439","repo":"apache/iceberg","slug":"failure-during-rewrite-process-for-group-7a5ae1","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/v4.0/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/v4.0/spark/src/main/java/org/apache/iceberg/spark/actions/RewriteDataFilesSparkAction.java#L255-L291","documentation":"WARN log from RewriteDataFilesSparkAction.doExecute: when a rewrite file group fails during its Spark job, the Tasks.foreach onFailure hook logs the group's RewriteGroupInfo and exception, then the action continues (with stopOnFailure stopping subsequent scheduling of this batch) rather than aborting the whole statement.","triggerScenarios":"Running `rewrite_data_files` (or RewriteDataFilesSparkAction.execute) and one group's rewrite job throws — e.g. OOM in the Spark task, schema/partition eval errors, or write failure to the target location.","commonSituations":"Executor OOM on large data files, unsupported partition transforms in filters, transient object-store write errors, speculative-execution kill of a task.","solutions":["Find the corresponding executor error in the Spark logs (the exception here is the wrapper).","Reduce group size via rewrite-options like max-file-group-size-bytes or lower partial-progress.max-commits so groups are smaller.","Increase executor memory/parallelism if failures are OOM-driven.","Re-run the action; only failed groups are rewritten again since successful groups already committed."],"exampleFix":"null","handlingStrategy":"retry","validationCode":"// ensure table is readable and metadata current before rewrite\ntable.refresh();","typeGuard":null,"tryCatchPattern":"try { result = action.execute(); } catch (Exception e) { /* inspect per-group logs; re-run action for failed groups only */ }","preventionTips":["Size groups smaller (max-file-group-size-bytes) to reduce per-task OOM","Provision adequate executor memory for large-file compaction","Keep table metadata refreshed to avoid stale-plan write errors"],"tags":["logging","spark","data-compaction","rewrite"],"backgroundTag":"spark-job-failure","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"}