{"record":{"id":"b135d978bc29938c","repo":"apache/hadoop","slug":"ha-for-namenode-is-not-enabled","errorCode":null,"errorMessage":"HA for namenode is not enabled","messagePattern":"HA for namenode is not enabled","errorType":"exception","errorClass":"ServiceFailedException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java","lineNumber":2015,"sourceCode":"      // log a warning if it take >= 5 seconds.\n      LOG.warn(\"Remote IP {} checking available resources took {}ms\",\n          Server.getRemoteIp(), end - start);\n    }\n    if (!getNamesystem().nameNodeHasResourcesAvailable()) {\n      throw new HealthCheckFailedException(\n          \"The NameNode has no resources available\");\n    }\n    if (notBecomeActiveInSafemode && isInSafeMode()) {\n      throw new HealthCheckFailedException(\"The NameNode is configured to \" +\n          \"report UNHEALTHY to ZKFC in Safemode.\");\n    }\n  }\n  \n  synchronized void transitionToActive() throws IOException {\n    String operationName = \"transitionToActive\";\n    namesystem.checkSuperuserPrivilege(operationName);\n    if (!haEnabled) {\n      throw new ServiceFailedException(\"HA for namenode is not enabled\");\n    }\n    if (state == OBSERVER_STATE) {\n      throw new ServiceFailedException(\n          \"Cannot transition from '\" + OBSERVER_STATE + \"' to '\" +\n              ACTIVE_STATE + \"'\");\n    }\n    if (notBecomeActiveInSafemode && isInSafeMode()) {\n      throw new ServiceFailedException(getRole() + \" still not leave safemode\");\n    }\n    state.setState(haContext, ACTIVE_STATE);\n  }\n\n  synchronized void transitionToStandby() throws IOException {\n    String operationName = \"transitionToStandby\";\n    namesystem.checkSuperuserPrivilege(operationName);\n    if (!haEnabled) {\n      throw new ServiceFailedException(\"HA for namenode is not enabled\");\n    }","sourceCodeStart":1997,"sourceCodeEnd":2033,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java#L1997-L2033","documentation":"NameNode.transitionToActive throws ServiceFailedException 'HA for namenode is not enabled' when haEnabled is false - the NameNode was not configured with a nameservice containing multiple NameNodes. State-transition RPCs only exist for HA deployments; a non-HA NameNode is either simply running or not.","triggerScenarios":"Calling 'hdfs haadmin -transitionToActive <nnId>' (or the HAServiceProtocol transitionToActive RPC) against a NameNode started without dfs.nameservices/dfs.ha.namenodes.<id> HA configuration.","commonSituations":"Test or single-node clusters where HA admin commands are run out of habit; after removing HA config but keeping operational scripts that call haadmin; misconfigured auto-failover pointing at a non-HA NN.","solutions":["On a non-HA cluster, do not call HA admin transitions - the running NameNode already serves as active.","If HA is actually required, configure it: dfs.nameservices, dfs.ha.namenodes.<nameservice>, shared edits (QJM: dfs.namenode.shared.edits.dir), and fencing, then restart.","Verify with 'hdfs getconf -confKey dfs.nameservices' - empty output means HA is not configured for this NN."],"exampleFix":"# before\nhdfs haadmin -transitionToActive nn1   # non-HA cluster -> ServiceFailedException\n\n# after\n# non-HA: the single NameNode is already active - no transition exists\n# or add real HA config (dfs.nameservices + dfs.ha.namenodes.<id> + QJM) and retry","handlingStrategy":"validation","validationCode":"// only issue state transitions on real HA deployments\nString nameservice = conf.get(\"dfs.nameservices\");\nif (nameservice == null || conf.get(\"dfs.ha.namenodes.\" + nameservice) == null)\n  throw new IllegalStateException(\"not an HA deployment - skip transitionToActive\");","typeGuard":"boolean isHaNotEnabled(Throwable t) {\n  return t instanceof org.apache.hadoop.ha.ServiceFailedException\n      && \"HA for namenode is not enabled\".equals(t.getMessage());\n}","tryCatchPattern":null,"preventionTips":["Gate haadmin usage on 'hdfs getconf -confKey dfs.nameservices' being non-empty.","Maintain separate runbooks for HA vs non-HA clusters instead of one shared script.","Monitoring dashboards should branch on HA presence before showing transition controls."],"tags":["hdfs","namenode","ha","state-transition","configuration"],"backgroundTag":"ha-state-transition-failed","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}