{"record":{"id":"48dc5a9b627cc5dd","repo":"apache/hadoop","slug":"inconsistent-datanode-ids-name-node-returned","errorCode":null,"errorMessage":"Inconsistent Datanode IDs. Name-node returned {}. Expecting {}","messagePattern":"Inconsistent Datanode IDs\\. Name-node returned (.+?)\\. Expecting (.+?)","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":2102,"sourceCode":"        streamingAddr.getAddress().getHostAddress(), hostName, \n        storage.getDatanodeUuid(), getXferPort(), getInfoPort(),\n            infoSecurePort, getIpcPort());\n    return new DatanodeRegistration(dnId, storageInfo, \n        new ExportedBlockKeys(), VersionInfo.getVersion());\n  }\n\n  /**\n   * Check that the registration returned from a NameNode is consistent\n   * with the information in the storage. If the storage is fresh/unformatted,\n   * sets the storage ID based on this registration.\n   * Also updates the block pool's state in the secret manager.\n   */\n  synchronized void bpRegistrationSucceeded(DatanodeRegistration bpRegistration,\n      String blockPoolId) throws IOException {\n    id = bpRegistration;\n\n    if(!storage.getDatanodeUuid().equals(bpRegistration.getDatanodeUuid())) {\n      throw new IOException(\"Inconsistent Datanode IDs. Name-node returned \"\n          + bpRegistration.getDatanodeUuid()\n          + \". Expecting \" + storage.getDatanodeUuid());\n    }\n    \n    registerBlockPoolWithSecretManager(bpRegistration, blockPoolId);\n  }\n  \n  /**\n   * After the block pool has contacted the NN, registers that block pool\n   * with the secret manager, updating it with the secrets provided by the NN.\n   * @throws IOException on error\n   */\n  private synchronized void registerBlockPoolWithSecretManager(\n      DatanodeRegistration bpRegistration, String blockPoolId) throws IOException {\n    ExportedBlockKeys keys = bpRegistration.getExportedKeys();\n    if (!hasAnyBlockPoolRegistered) {\n      hasAnyBlockPoolRegistered = true;\n      isBlockTokenEnabled = keys.isBlockTokenEnabled();","sourceCodeStart":2084,"sourceCodeEnd":2120,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java#L2084-L2120","documentation":"Error \"Inconsistent Datanode IDs. Name-node returned {}. Expecting {}\" thrown in apache/hadoop.","triggerScenarios":"During registration, the NameNode returns a DataNode ID that differs from the ID this DataNode has stored, indicating storage from a different cluster or node.","commonSituations":"The NameNode returned a DataNode ID inconsistent with local storage, usually from reusing a data directory on a different node. Clear or correct the storage directories.","solutions":["Ensure the DataNode registers with the same NameNode/cluster it was formatted for; clear stale storage (datanodeUuid in VERSION files) if the node was reimaged.","Verify dfs.namenode addresses in hdfs-site.xml point to the intended NameNode and that no other cluster shares these storage directories."],"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"}