{"record":{"id":"ba5120b2659c855f","repo":"apache/hadoop","slug":"failed-to-replace-a-bad-datanode-on-the-existing-p","errorCode":null,"errorMessage":"Failed to replace a bad datanode on the existing pipeline due to no more good datanodes being available to try. (Nodes: current={}, original={}). The current failed datanode replacement policy is {}, and a client may configure this via 'dfs.client.block.write.replace-datanode-on-failure.policy' in its configuration.","messagePattern":"Failed to replace a bad datanode on the existing pipeline due to no more good datanodes being available to try\\. \\(Nodes: current=(.+?), original=(.+?)\\)\\. The current failed datanode replacement policy is (.+?), and a client may configure this via 'dfs\\.client\\.block\\.write\\.replace-datanode-on-failure\\.policy' in its configuration\\.","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DataStreamer.java","lineNumber":1452,"sourceCode":"          endOfBlockPacket.releaseBuffer(byteArrayManager);\n        }\n        endBlock();\n      } else {\n        initDataStreaming();\n      }\n    }\n\n    return false;\n  }\n\n  void setHflush() {\n    isHflushed = true;\n  }\n\n  private int findNewDatanode(final DatanodeInfo[] original\n  ) throws IOException {\n    if (nodes.length != original.length + 1) {\n      throw new IOException(\n          \"Failed to replace a bad datanode on the existing pipeline \"\n              + \"due to no more good datanodes being available to try. \"\n              + \"(Nodes: current=\" + Arrays.asList(nodes)\n              + \", original=\" + Arrays.asList(original) + \"). \"\n              + \"The current failed datanode replacement policy is \"\n              + dfsClient.dtpReplaceDatanodeOnFailure\n              + \", and a client may configure this via '\"\n              + BlockWrite.ReplaceDatanodeOnFailure.POLICY_KEY\n              + \"' in its configuration.\");\n    }\n    for(int i = 0; i < nodes.length; i++) {\n      int j = 0;\n      for(; j < original.length && !nodes[i].equals(original[j]); j++);\n      if (j == original.length) {\n        return i;\n      }\n    }\n    throw new IOException(\"Failed: new datanode not found: nodes=\"","sourceCodeStart":1434,"sourceCodeEnd":1470,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DataStreamer.java#L1434-L1470","documentation":"Error \"Failed to replace a bad datanode on the existing pipeline due to no more good datanodes being available to try. (Nodes: current={}, original={}). The current failed datanode replacement policy is {}, and a client may configure this via 'dfs.client.block.write.replace-datanode-on-failure.policy' in its configuration.\" thrown in apache/hadoop.","triggerScenarios":"A DataNode in the write pipeline fails and the client tries to replace it, but no additional healthy DataNodes are available. Whether the write fails depends on dfs.client.block.write.replace-datanode-on-failure.policy.","commonSituations":"See trigger scenarios.","solutions":["Add more healthy DataNodes to the cluster so a replacement node is available for the pipeline.","Change dfs.client.block.write.replace-datanode-on-failure.policy (NEVER/DEFAULT/ALWAYS) to match cluster size; small clusters should use NEVER or DEFAULT.","Ensure failed DataNodes are decommissioned or recovered so enough nodes satisfy the replication factor."],"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"}