apache/hadoop · error · PrematureEOFException

got premature end-of-file at txid {}; expected file to go up

Error message

got premature end-of-file at txid {}; expected file to go up to {}

What it means

Error "got premature end-of-file at txid {}; expected file to go up to {}" thrown in apache/hadoop.

Source

Thrown at hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/RedundantEditLogInputStream.java:209

            streams[curIdx].skipUntil(prevTxId + 1);
          }
        } catch (IOException e) {
          prevException = e;
          state = State.STREAM_FAILED;
          LOG.warn("Got error skipUntil edit log input stream {}.", streams[curIdx].getName());
          break;
        }
        state = State.OK;
        break;
      case OK:
        try {
          FSEditLogOp op = streams[curIdx].readOp();
          if (op == null) {
            state = State.EOF;
            if (streams[curIdx].getLastTxId() == prevTxId) {
              return null;
            } else {
              throw new PrematureEOFException("got premature end-of-file " +
                  "at txid " + prevTxId + "; expected file to go up to " +
                  streams[curIdx].getLastTxId());
            }
          }
          prevTxId = op.getTransactionId();
          return op;
        } catch (IOException e) {
          prevException = e;
          state = State.STREAM_FAILED;
        }
        break;
      case STREAM_FAILED:
        if (curIdx + 1 == streams.length) {
          throw prevException;
        }
        long oldLast = streams[curIdx].getLastTxId();
        long newLast = streams[curIdx + 1].getLastTxId();
        if (newLast < oldLast) {

View on GitHub (pinned to 2add963021)

Solutions

  1. Supply the missing edit log segments (from another JournalNode or storage dir) covering up to the expected txid, or recover metadata from a checkpoint.

When it happens

Trigger: During edits loading, an edit log stream ends before the transaction ID the NameNode expected.

Common situations: Lost or truncated edit log files after JournalNode disk failure or incomplete log transfer.


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