apache/hadoop · error · PathCommitException

Mismatch in Job ID (%s) and commit job ID (%s)

Error message

Mismatch in Job ID (%s) and commit job ID (%s)

What it means

During job commit the committer loads each pendingset file and compares the jobId recorded in it with its own job UUID; a non-empty mismatch throws PathCommitException 'Mismatch in Job ID'. This guard stops one job from committing (or aborting) another job's pending multipart uploads, which could publish foreign data or delete a live job's output.

Source

Thrown at hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/commit/AbstractS3ACommitter.java:753

   * @throws IOException failure
   */
  private void loadAndCommit(
      final CommitContext commitContext,
      final ActiveCommit activeCommit,
      final FileStatus status) throws IOException {

    final Path path = status.getPath();
    commitContext.switchToIOStatisticsContext();
    try (DurationInfo ignored =
             new DurationInfo(LOG,
                 "Loading and committing files in pendingset %s", path)) {
      PendingSet pendingSet = PersistentCommitData.load(
          activeCommit.getSourceFS(),
          status,
          commitContext.getPendingSetSerializer());
      String jobId = pendingSet.getJobId();
      if (!StringUtils.isEmpty(jobId) && !getUUID().equals(jobId)) {
        throw new PathCommitException(path,
            String.format("Mismatch in Job ID (%s) and commit job ID (%s)",
                getUUID(), jobId));
      }
      TaskPool.foreach(pendingSet.getCommits())
          .stopOnFailure()
          .suppressExceptions(false)
          .executeWith(commitContext.getInnerSubmitter())
          .onFailure((commit, exception) ->
              commitContext.abortSingleCommit(commit))
          .abortWith(commitContext::abortSingleCommit)
          .revertWith(commitContext::revertCommit)
          .run(commit -> {
            commitContext.commitOrFail(commit);
            activeCommit.uploadCommitted(
                commit.getDestinationKey(), commit.getLength());
          });
      activeCommit.pendingsetCommitted(pendingSet.getIOStatistics());
    }

View on GitHub (pinned to 2add963021)

Solutions

  1. Write to a fresh output path, or delete the destination's _temporary directory (and staging dirs) before rerunning a failed job
  2. Ensure spark.sql.sources.writeJobUUID is unique per job (SPARK-33230+) so concurrent jobs cannot collide
  3. Never reuse task attempt paths/IDs across job runs; let the framework generate new ones

Example fix

# before: rerun into a dirty output path
spark-submit --conf spark.sql.sources.writeJobUUID=8f1c0c10-...  # reused/stale UUID

# after: clean state, unique UUID per run
hadoop fs -rm -r s3a://bucket/out/_temporary
spark-submit  # Spark sets spark.sql.sources.writeJobUUID per job; do not pin it
Defensive patterns

Strategy: validation

Validate before calling

// before submitting, ensure no foreign pendingsets sit in the output working dir
Path tmp = new Path(outputPath, "_temporary");
if (destFS.exists(tmp)) {
  LOG.warn("Stale {} from a previous run; removing", tmp);
  destFS.delete(tmp, true);
}

Prevention

When it happens

Trigger: calculateCommitActions loads a PendingSet under the job's commit directory whose getJobId() differs from getUUID(). The file was written by a different job run: stale _temporary/pending directories from a previous attempt sharing the output path, or two concurrent jobs colliding on the same paths.

Common situations: Rerunning a failed job into the same output directory without cleaning _temporary; Spark jobs without unique write UUIDs (pre-SPARK-33230) overwriting each other's working dirs; staging directory reuse between runs.

Related errors


AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22). Data as JSON: /api/errors/a0ea87a0cd322c03. Report an issue: GitHub.