{"record":{"id":"480a095fd1d7d19e","repo":"apache/hadoop","slug":"is-neither-a-rbw-nor-a-finalized-r","errorCode":null,"errorMessage":"{} is neither a RBW nor a Finalized, r={}","messagePattern":"(.+?) is neither a RBW nor a Finalized, r=(.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java","lineNumber":3656,"sourceCode":"      if (null == storedBlock) {\n        throw new IOException(b + \" not found in datanode.\");\n      }\n      storedGS = storedBlock.getGenerationStamp();\n      if (storedGS < b.getGenerationStamp()) {\n        throw new IOException(storedGS\n            + \" = storedGS < b.getGenerationStamp(), b=\" + b);\n      }\n      // Update the genstamp with storedGS\n      b.setGenerationStamp(storedGS);\n      if (data.isValidRbw(b)) {\n        stage = BlockConstructionStage.TRANSFER_RBW;\n        LOG.debug(\"Replica is being written!\");\n      } else if (data.isValidBlock(b)) {\n        stage = BlockConstructionStage.TRANSFER_FINALIZED;\n        LOG.debug(\"Replica is finalized!\");\n      } else {\n        final String r = data.getReplicaString(b.getBlockPoolId(), b.getBlockId());\n        throw new IOException(b + \" is neither a RBW nor a Finalized, r=\" + r);\n      }\n      visible = data.getReplicaVisibleLength(b);\n    }\n    //set visible length\n    b.setNumBytes(visible);\n\n    if (targets.length > 0) {\n      if (LOG.isDebugEnabled()) {\n        final String xferTargetsString =\n            StringUtils.join(\" \", Arrays.asList(targets));\n        LOG.debug(\"Transferring a replica to {}\", xferTargetsString);\n      }\n\n      final DataTransfer dataTransferTask = new DataTransfer(targets,\n          targetStorageTypes, targetStorageIds, b, stage, client);\n\n      @SuppressWarnings(\"unchecked\")\n      Future<Void> f = (Future<Void>) this.xferService.submit(dataTransferTask);","sourceCodeStart":3638,"sourceCodeEnd":3674,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java#L3638-L3674","documentation":"Error \"{} is neither a RBW nor a Finalized, r={}\" thrown in apache/hadoop.","triggerScenarios":"An updateBlock operation is applied to a replica that is neither RBW nor FINALIZED, e.g., one under recovery.","commonSituations":"An operation expected an RBW or finalized replica but found another state, typically a race with recovery or deletion. Retry the operation.","solutions":["Use a replica in RBW or FINALIZED state for this operation; replicas being recovered (RUR/RWR) must be handled via the recovery path.","Check why the replica is in an unexpected state (ReplicaState) and complete or abort the ongoing recovery first."],"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-23T01:17:44.959Z"}