{"record":{"id":"369a2a48eda1bb0e","repo":"apache/hadoop","slug":"got-premature-end-of-file-at-txid-expected-fil","errorCode":null,"errorMessage":"got premature end-of-file at txid {}; expected file to go up to {}","messagePattern":"got premature end-of-file at txid (.+?); expected file to go up to (.+?)","errorType":"exception","errorClass":"PrematureEOFException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/RedundantEditLogInputStream.java","lineNumber":209,"sourceCode":"            streams[curIdx].skipUntil(prevTxId + 1);\n          }\n        } catch (IOException e) {\n          prevException = e;\n          state = State.STREAM_FAILED;\n          LOG.warn(\"Got error skipUntil edit log input stream {}.\", streams[curIdx].getName());\n          break;\n        }\n        state = State.OK;\n        break;\n      case OK:\n        try {\n          FSEditLogOp op = streams[curIdx].readOp();\n          if (op == null) {\n            state = State.EOF;\n            if (streams[curIdx].getLastTxId() == prevTxId) {\n              return null;\n            } else {\n              throw new PrematureEOFException(\"got premature end-of-file \" +\n                  \"at txid \" + prevTxId + \"; expected file to go up to \" +\n                  streams[curIdx].getLastTxId());\n            }\n          }\n          prevTxId = op.getTransactionId();\n          return op;\n        } catch (IOException e) {\n          prevException = e;\n          state = State.STREAM_FAILED;\n        }\n        break;\n      case STREAM_FAILED:\n        if (curIdx + 1 == streams.length) {\n          throw prevException;\n        }\n        long oldLast = streams[curIdx].getLastTxId();\n        long newLast = streams[curIdx + 1].getLastTxId();\n        if (newLast < oldLast) {","sourceCodeStart":191,"sourceCodeEnd":227,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/RedundantEditLogInputStream.java#L191-L227","documentation":"Error \"got premature end-of-file at txid {}; expected file to go up to {}\" thrown in apache/hadoop.","triggerScenarios":"During edits loading, an edit log stream ends before the transaction ID the NameNode expected.","commonSituations":"Lost or truncated edit log files after JournalNode disk failure or incomplete log transfer.","solutions":["Supply the missing edit log segments (from another JournalNode or storage dir) covering up to the expected txid, or recover metadata from a checkpoint."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}