{"record":{"id":"81217dc355a4f24a","repo":"apache/hadoop","slug":"s02","errorCode":"S02","errorMessage":"[{0}] is not a directory","messagePattern":"\\[(.+?)\\] is not a directory","errorType":"error_code","errorClass":"ServerException","httpStatus":null,"severity":"critical","filePath":"hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/lib/server/Server.java","lineNumber":403,"sourceCode":"    setStatus(status);\n    log.info(\"Server [{}] started!, status [{}]\", name, status);\n  }\n\n  /**\n   * Verifies the specified directory exists.\n   *\n   * @param dir directory to verify it exists.\n   *\n   * @throws ServerException thrown if the directory does not exist or it the\n   * path it is not a directory.\n   */\n  private void verifyDir(String dir) throws ServerException {\n    File file = new File(dir);\n    if (!file.exists()) {\n      throw new ServerException(ServerException.ERROR.S01, dir);\n    }\n    if (!file.isDirectory()) {\n      throw new ServerException(ServerException.ERROR.S02, dir);\n    }\n  }\n\n  /**\n   * Initializes Log4j logging.\n   *\n   * @throws ServerException thrown if Log4j could not be initialized.\n   */\n  protected void initLog() throws ServerException {\n    verifyDir(logDir);\n    LogManager.resetConfiguration();\n    File log4jFile = new File(configDir, name + \"-log4j.properties\");\n    if (log4jFile.exists()) {\n      PropertyConfigurator.configureAndWatch(log4jFile.toString(), 10 * 1000); //every 10 secs\n      log = LoggerFactory.getLogger(Server.class);\n    } else {\n      Properties props = new Properties();\n      try {","sourceCodeStart":385,"sourceCodeEnd":421,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/lib/server/Server.java#L385-L421","documentation":"Server.verifyDir() first checks existence (S01) and then that the path is a directory; if a regular file (or anything non-directory) occupies the path, it throws ServerException S02('[<path>] is not a directory'). Like S01, this aborts HttpFS startup at construction time.","triggerScenarios":"httpfs.log.dir=/var/log/hadoop-httpfs where hadoop-httpfs is a log FILE created earlier by a redirect; a config dir path occupied by a tarball or marker file; a bind-mounted file where a directory mount was intended; scripts that 'touch' paths to pre-create them.","commonSituations":"Operators pre-creating paths with touch instead of mkdir -p; log directories accidentally created as files by init scripts ('> /var/log/x'); Docker volumes mapping a file onto a path the server expects to be a directory.","solutions":["Inspect the path from the message: ls -ld <path> — if it is a file, remove or relocate it and mkdir -p the directory.","Correct the owning property (httpfs.home.dir/config.dir/log.dir/temp.dir) to the intended directory.","Fix provisioning scripts to use mkdir -p, never touch, for directory paths."],"exampleFix":"# before\n$ ls -ld /var/log/hadoop-httpfs\n-rw-r--r-- 1 httpfs hadoop 0 ... /var/log/hadoop-httpfs   # a file\n\n# after\n$ rm /var/log/hadoop-httpfs\n$ mkdir -p /var/log/hadoop-httpfs && chown httpfs:hadoop /var/log/hadoop-httpfs","handlingStrategy":"validation","validationCode":"# pre-start: every configured dir must be a directory\nfor d in \"$HTTPFS_HOME\" \"$HTTPFS_CONFIG\" \"$HTTPFS_LOG\" \"$HTTPFS_TEMP\"; do\n  [ -z \"$d\" ] && continue\n  [ -d \"$d\" ] || { echo \"FATAL: $d is not a directory\"; exit 1; }\ndone","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use mkdir -p (never touch) when pre-creating directory paths.","Double-check Docker/K8s volume mappings: directories map to directories.","Rehearse deployments on a clean host to catch file/dir collisions early."],"tags":["httpfs","server-startup","path-validation","filesystem","configuration"],"backgroundTag":"missing-directory","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}