{"record":{"id":"722c61c2c144e77a","repo":"apache/hadoop","slug":"all-specified-directories-are-not-accessible-or-do","errorCode":null,"errorMessage":"All specified directories are not accessible or do not exist.","messagePattern":"All specified directories are not accessible or do not exist\\.","errorType":"exception","errorClass":"java.io.IOException","httpStatus":null,"severity":"critical","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImage.java","lineNumber":237,"sourceCode":"   * Perform fs state transition if necessary depending on the namespace info.\n   * Read storage info. \n   * \n   * @throws IOException\n   * @return true if the image needs to be saved or false otherwise\n   */\n  boolean recoverTransitionRead(StartupOption startOpt, FSNamesystem target,\n      MetaRecoveryContext recovery)\n      throws IOException {\n    assert startOpt != StartupOption.FORMAT : \n      \"NameNode formatting should be performed before reading the image\";\n    \n    Collection<URI> imageDirs = storage.getImageDirectories();\n    Collection<URI> editsDirs = editLog.getEditURIs();\n\n    // none of the data dirs exist\n    if((imageDirs.size() == 0 || editsDirs.size() == 0) \n                             && startOpt != StartupOption.IMPORT)  \n      throw new IOException(\n          \"All specified directories are not accessible or do not exist.\");\n    \n    // 1. For each data directory calculate its state and \n    // check whether all is consistent before transitioning.\n    Map<StorageDirectory, StorageState> dataDirStates = \n             new HashMap<StorageDirectory, StorageState>();\n    boolean isFormatted = recoverStorageDirs(startOpt, storage, dataDirStates);\n\n    if (LOG.isTraceEnabled()) {\n      LOG.trace(\"Data dir states:\\n  \" +\n        Joiner.on(\"\\n  \").withKeyValueSeparator(\": \")\n        .join(dataDirStates));\n    }\n    \n    if (!isFormatted && startOpt != StartupOption.ROLLBACK \n                     && startOpt != StartupOption.IMPORT) {\n      throw new IOException(\"NameNode is not formatted.\");      \n    }","sourceCodeStart":219,"sourceCodeEnd":255,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImage.java#L219-L255","documentation":"At NameNode startup, FSImage.recoverTransitionRead() resolved the image dirs (dfs.namenode.name.dir) and edits dirs (dfs.namenode.edits.dir) and one of the two collections came up empty — no usable configured directory — while the startup option is not IMPORT. With nowhere to read or write metadata the NameNode refuses to start rather than silently formatting something.","triggerScenarios":"dfs.namenode.name.dir or dfs.namenode.edits.dir unset, empty, or resolving to zero URIs for this nameservice (typical in HA/federation misconfiguration); config file not picked up because HADOOP_CONF_DIR points elsewhere; property name typos.","commonSituations":"Fresh deployment with incomplete hdfs-site.xml; HA setup where the local edits dir list is empty because only a shared dir was intended but misnamed; empty-string overrides from templating; running the NameNode host with the wrong environment.","solutions":["Check the effective config on the failing host: hdfs getconf -confKey dfs.namenode.name.dir and hdfs getconf -confKey dfs.namenode.edits.dir.","Set valid URIs (e.g. file:///dfs/hadoop/hdfs/namenode, or qjournal://jn1:8485;jn2:8485;jn3:8485/mycluster for HA) and confirm HADOOP_CONF_DIR is right.","Create the directories with correct ownership (usually hdfs:hdfs) and writable permissions.","If this is a brand-new cluster, format once the config is fixed: hdfs namenode -format."],"exampleFix":"<!-- before: no storage configured -->\n<property><name>dfs.namenode.name.dir</name><value></value></property>\n\n<!-- after -->\n<property>\n  <name>dfs.namenode.name.dir</name>\n  <value>file:///dfs/hadoop/hdfs/namenode</value>\n</property>\n<property>\n  <name>dfs.namenode.edits.dir</name>\n  <value>qjournal://jn1:8485;jn2:8485;jn3:8485/mycluster</value>\n</property>","handlingStrategy":"validation","validationCode":"for (String key : new String[]{\n        DFSConfigKeys.DFS_NAMENODE_NAME_DIR_KEY,\n        DFSConfigKeys.DFS_NAMENODE_EDITS_DIR_KEY}) {\n  Collection<String> vals = conf.getTrimmedStringCollection(key);\n  if (vals.isEmpty()) {\n    throw new IllegalStateException(key + \" resolved to no directories\");\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Automate preflight checks for name.dir/edits.dir before every NameNode start.","Use 'hdfs getconf' to diff effective config across nodes.","Never ship an empty <value/> for storage location keys."],"tags":["hdfs","namenode","configuration","storage-directory","startup"],"backgroundTag":"missing-storage-directory","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}