{"record":{"id":"430c36f1dba94306","repo":"apache/hadoop","slug":"unable-to-create-new-block","errorCode":null,"errorMessage":"Unable to create new block.","messagePattern":"Unable to create new block\\.","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":1865,"sourceCode":"        LOG.warn(\"Exception in setupPipelineForCreate \" + this, ie);\n        success = false;\n      }\n      if (!success) {\n        LOG.warn(\"Abandoning \" + block);\n        dfsClient.namenode.abandonBlock(block.getCurrentBlock(),\n            stat.getFileId(), src, dfsClient.clientName);\n        block.setCurrentBlock(null);\n        final DatanodeInfo badNode = errorState.getBadNodeIndex() == -1\n              ? Iterables.getLast(failed)\n              : nodes[errorState.getBadNodeIndex()];\n        LOG.warn(\"Excluding datanode \" + badNode);\n        excludedNodes.put(badNode, badNode);\n        setPipeline(null, null, null);\n      }\n    } while (!success && --count >= 0);\n\n    if (!success) {\n      throw new IOException(\"Unable to create new block.\");\n    }\n  }\n\n  // connects to the first datanode in the pipeline\n  // Returns true if success, otherwise return failure.\n  //\n  boolean createBlockOutputStream(DatanodeInfo[] nodes,\n      StorageType[] nodeStorageTypes, String[] nodeStorageIDs,\n      long newGS, boolean recoveryFlag) {\n    if (nodes.length == 0) {\n      LOG.info(\"nodes are empty for write pipeline of \" + block);\n      return false;\n    }\n    String firstBadLink = \"\";\n    boolean checkRestart = false;\n    if (LOG.isDebugEnabled()) {\n      LOG.debug(\"pipeline = \" + Arrays.toString(nodes) + \", \" + this);\n    }","sourceCodeStart":1847,"sourceCodeEnd":1883,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DataStreamer.java#L1847-L1883","documentation":"Error \"Unable to create new block.\" thrown in apache/hadoop.","triggerScenarios":"The client asks the NameNode to allocate a new block during a write or append, and the allocation fails (for example NameNode error, safemode, or no usable DataNodes), so the streamer cannot proceed.","commonSituations":"See trigger scenarios.","solutions":["Check NameNode logs for block allocation failures (no space, no live DataNodes, safemode).","Verify enough DataNodes are live and have free storage via hdfs dfsadmin -report.","Check dfs.replication vs number of available DataNodes and adjust if the cluster is too small."],"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"}