{"record":{"id":"944fce6fbfa41efc","repo":"apache/hadoop","slug":"error-converting-txidresponseproto-got-a-transact","errorCode":null,"errorMessage":"Error converting TxidResponseProto: got a transaction id {} that was outside the range of [{}, {}].","messagePattern":"Error converting TxidResponseProto: got a transaction id (.+?) that was outside the range of \\[(.+?), (.+?)\\]\\.","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocolPB/PBHelperClient.java","lineNumber":887,"sourceCode":"      policies[i++] = convert(proto);\n    }\n    return policies;\n  }\n\n  public static EventBatchList convert(GetEditsFromTxidResponseProto resp)\n      throws IOException {\n    final InotifyProtos.EventsListProto list = resp.getEventsList();\n    final long firstTxid = list.getFirstTxid();\n    final long lastTxid = list.getLastTxid();\n\n    List<EventBatch> batches = Lists.newArrayList();\n    if (list.getEventsList().size() > 0) {\n      throw new IOException(\"Can't handle old inotify server response.\");\n    }\n    for (InotifyProtos.EventBatchProto bp : list.getBatchList()) {\n      long txid = bp.getTxid();\n      if ((txid != -1) && ((txid < firstTxid) || (txid > lastTxid))) {\n        throw new IOException(\"Error converting TxidResponseProto: got a \" +\n            \"transaction id \" + txid + \" that was outside the range of [\" +\n            firstTxid + \", \" + lastTxid + \"].\");\n      }\n      List<Event> events = Lists.newArrayList();\n      for (InotifyProtos.EventProto p : bp.getEventsList()) {\n        switch (p.getType()) {\n        case EVENT_CLOSE:\n          InotifyProtos.CloseEventProto close =\n              InotifyProtos.CloseEventProto.parseFrom(p.getContents());\n          events.add(new Event.CloseEvent(close.getPath(),\n              close.getFileSize(), close.getTimestamp()));\n          break;\n        case EVENT_CREATE:\n          InotifyProtos.CreateEventProto create =\n              InotifyProtos.CreateEventProto.parseFrom(p.getContents());\n          Event.CreateEvent.Builder builder = new Event.CreateEvent.Builder()\n                  .iNodeType(createTypeConvert(create.getType()))\n                  .path(create.getPath())","sourceCodeStart":869,"sourceCodeEnd":905,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocolPB/PBHelperClient.java#L869-L905","documentation":"Each EventBatchProto in an inotify response must carry a txid inside the envelope's [firstTxid, lastTxid] window (or the sentinel -1). A batch outside that window means the response is internally inconsistent - typically a NameNode bug or protocol/version skew - and event ordering can no longer be trusted, so conversion throws IOException.","triggerScenarios":"getEditsFromTxid returns batches whose bp.getTxid() is less than firstTxid or greater than lastTxid while PBHelperClient.convert(GetEditsFromTxidResponseProto) walks the batch list.","commonSituations":"Rare; observed with NameNode bugs around concurrent edit tailing, mixed NN versions during rolling upgrade, or corrupted RPC responses.","solutions":["Retry the inotify fetch starting from the last successfully processed txid","Verify all NameNodes run the same version and check NN logs for edit-tailing anomalies","If reproducible, capture the reported txid/window values and upgrade the affected component - the inconsistency originates server-side"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  batches = convert(resp);\n} catch (IOException e) {\n  if (e.getMessage() != null && e.getMessage().contains(\"outside the range\")) {\n    batches = inotifyFetch(lastSeenTxid); // refetch from checkpoint; report if persistent\n  } else {\n    throw e;\n  }\n}","preventionTips":["Checkpoint lastSeenTxid after every processed batch","Alert on repeated txid-range violations - they indicate a server-side problem"],"tags":["hdfs","inotify","protocol-invariant","txid"],"backgroundTag":"server-protocol-violation","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}