{"record":{"id":"c9bcfab4b8ce03bd","repo":"apache/hadoop","slug":"replica-of-type-getstate-does-not-support-set-c9bcfa","errorCode":null,"errorMessage":"Replica of type ${getState()} does not support setRecoveryID","messagePattern":"Replica of type (.+?) does not support setRecoveryID","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/LocalReplicaInPipeline.java","lineNumber":403,"sourceCode":"        + \"\\n  bytesAcked=\" + bytesAcked\n        + \"\\n  bytesOnDisk=\" + bytesOnDisk;\n  }\n\n  @Override\n  public ReplicaInfo getOriginalReplica() {\n    throw new UnsupportedOperationException(\"Replica of type \" + getState() +\n        \" does not support getOriginalReplica\");\n  }\n\n  @Override\n  public long getRecoveryID() {\n    throw new UnsupportedOperationException(\"Replica of type \" + getState() +\n        \" does not support getRecoveryID\");\n  }\n\n  @Override\n  public void setRecoveryID(long recoveryId) {\n    throw new UnsupportedOperationException(\"Replica of type \" + getState() +\n        \" does not support setRecoveryID\");\n  }\n\n  @Override\n  public ReplicaRecoveryInfo createInfo(){\n    throw new UnsupportedOperationException(\"Replica of type \" + getState() +\n        \" does not support createInfo\");\n  }\n\n  public void moveReplicaFrom(ReplicaInfo oldReplicaInfo, File newBlkFile)\n      throws IOException {\n\n    if (!(oldReplicaInfo instanceof LocalReplica)) {\n      throw new IOException(\"The source replica with blk id \"\n          + oldReplicaInfo.getBlockId()\n          + \" should be derived from LocalReplica\");\n    }\n","sourceCodeStart":385,"sourceCodeEnd":421,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/LocalReplicaInPipeline.java#L385-L421","documentation":"Error \"Replica of type ${getState()} does not support setRecoveryID\" thrown in apache/hadoop.","triggerScenarios":"setRecoveryID is invoked on a replica type that does not support recovery IDs.","commonSituations":"setRecoveryID was called on a replica type that does not track recovery IDs. Internal misuse; use ReplicaUnderRecovery instead.","solutions":["Only set a recovery ID on ReplicaUnderRecovery instances; check replica state first.","Route recovery through the standard block recovery workflow rather than mutating ordinary replicas."],"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"}