{"record":{"id":"41fad57890710fc4","repo":"apache/hadoop","slug":"replica-of-type-getstate-does-not-support-cre","errorCode":null,"errorMessage":"Replica of type ${getState()} does not support createInfo","messagePattern":"Replica of type (.+?) does not support createInfo","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/FinalizedProvidedReplica.java","lineNumber":119,"sourceCode":"    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","sourceCodeStart":101,"sourceCodeEnd":123,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/FinalizedProvidedReplica.java#L101-L123","documentation":"createInfo() builds the ReplicaRecoveryInfo exchanged in the block-recovery handshake. For a FinalizedProvidedReplica the DataNode cannot serve recovery from external PROVIDED storage, and there is no local length/generation metadata to report the way local finalized replicas do, so the method throws UnsupportedOperationException.","triggerScenarios":"Block-recovery flow calling createInfo() on a provided replica — e.g., startBlockRecovery gathering info from every replica in the volume map including PROVIDED ones.","commonSituations":"PROVIDED-storage clusters triggering recovery on blocks whose local presence is provided; generic recovery tooling that calls createInfo() on all replicas regardless of type; framework versions whose recovery path predates provided-storage support.","solutions":["Restrict createInfo() calls to replicas that support recovery (local RBW/RWR/RUR, or finalized local replicas in flows designed for them).","When a block has a provided replica locally, answer recovery from another DataNode's replica.","Upgrade to a HDFS release containing provided-storage guards for the failing flow and verify against its JIRA.","Return a failure the recovery protocol understands instead of letting UnsupportedOperationException escape."],"exampleFix":"// before\nReplicaRecoveryInfo info = replica.createInfo();\n\n// after: type-check before building recovery info\nif (replica instanceof ReplicaUnderReconstruction) {\n  ReplicaRecoveryInfo info = replica.createInfo();\n} else {\n  // provided replica: report 'cannot recover locally' to the recovery flow\n}","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"static boolean canBuildRecoveryInfo(ReplicaInfo r) {\n  return r instanceof ReplicaUnderReconstruction;\n}","tryCatchPattern":"try {\n  ReplicaRecoveryInfo info = replica.createInfo();\n} catch (UnsupportedOperationException e) {\n  // provided replica cannot serve recovery info locally: answer from another DataNode\n}","preventionTips":["Build ReplicaRecoveryInfo only from replicas that participate in recovery","In PROVIDED clusters, ensure recovery picks a non-provided replica elsewhere","Let unsupported cases surface as protocol-level failures rather than escaping runtime exceptions"],"tags":["provided-storage","replica","recovery","unsupported-operation","hdfs"],"backgroundTag":"unsupported-operation","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}