{"record":{"id":"45305dcf1f62c017","repo":"apache/hadoop","slug":"block-report-0x-was-rejected-as-lease-0x-is-in","errorCode":null,"errorMessage":"Block report 0x{} was rejected as lease 0x{} is invalid","messagePattern":"Block report 0x(.+?) was rejected as lease 0x(.+?) is invalid","errorType":"exception","errorClass":"InvalidBlockReportLeaseException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNodeRpcServer.java","lineNumber":1668,"sourceCode":"    final BlockManager bm = namesystem.getBlockManager(); \n    boolean noStaleStorages = false;\n    try {\n      if (bm.checkBlockReportLease(context, nodeReg)) {\n        for (int r = 0; r < reports.length; r++) {\n          final BlockListAsLongs blocks = reports[r].getBlocks();\n          //\n          // BlockManager.processReport accumulates information of prior calls\n          // for the same node and storage, so the value returned by the last\n          // call of this loop is the final updated value for noStaleStorage.\n          //\n          final int index = r;\n          noStaleStorages = bm.runBlockOp(() ->\n            bm.processReport(nodeReg, reports[index].getStorage(),\n                blocks, context));\n        }\n      } else {\n        if (bm.shouldRejectInvalidBlockReportLease()) {\n          throw new InvalidBlockReportLeaseException(\n              context.getReportId(), context.getLeaseId());\n        }\n      }\n    } catch (UnregisteredNodeException une) {\n      LOG.warn(\"Datanode {} is attempting to report but not register yet.\",\n          nodeReg);\n      return RegisterCommand.REGISTER;\n    }\n    bm.removeBRLeaseIfNeeded(nodeReg, context);\n\n    BlockManagerFaultInjector.getInstance().\n        incomingBlockReportRpc(nodeReg, context);\n\n    if (nn.getFSImage().isUpgradeFinalized() &&\n        !namesystem.isRollingUpgrade() &&\n        nn.isActiveState() &&\n        noStaleStorages) {\n      return new FinalizeCommand(poolId);","sourceCodeStart":1650,"sourceCodeEnd":1686,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNodeRpcServer.java#L1650-L1686","documentation":"Error \"Block report 0x{} was rejected as lease 0x{} is invalid\" thrown in apache/hadoop.","triggerScenarios":"A DataNode sends a block report whose lease ID does not match the NameNode's registered lease, e.g., after NameNode restart.","commonSituations":"Stale DataNodes reporting blocks to a freshly restarted or failover NameNode.","solutions":["Restart or re-register the DataNode so it obtains a valid lease/pool registration before sending block reports."],"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"}