{"record":{"id":"09d756d5f6c00adc","repo":"apache/hadoop","slug":"can-t-make-directory-for-path-s-since-it-is-a-fil-09d756","errorCode":null,"errorMessage":"Can't make directory for path %s since it is a file.","messagePattern":"Can't make directory for path (.+?) since it is a file\\.","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/sftp/SFTPFileSystem.java","lineNumber":344,"sourceCode":"      Path parent = absolute.getParent();\n      created =\n          (parent == null || mkdirs(client, parent, FsPermission.getDefault()));\n      if (created) {\n        String parentDir = parent.toUri().getPath();\n        boolean succeeded = true;\n        try {\n          final String previousCwd = client.pwd();\n          client.cd(parentDir);\n          client.mkdir(pathName);\n          client.cd(previousCwd);\n        } catch (SftpException e) {\n          throw new IOException(String.format(E_MAKE_DIR_FORPATH, pathName,\n              parentDir));\n        }\n        created = created & succeeded;\n      }\n    } else if (isFile(client, absolute)) {\n      throw new IOException(String.format(E_DIR_CREATE_FROMFILE, absolute));\n    }\n    return created;\n  }\n\n  /**\n   * Convenience method, so that we don't open a new connection when using this\n   * method from within another method. Otherwise every API invocation incurs\n   * the overhead of opening/closing a TCP connection.\n   * @throws IOException\n   */\n  private boolean isFile(ChannelSftp channel, Path file) throws IOException {\n    try {\n      return !getFileStatus(channel, file).isDirectory();\n    } catch (FileNotFoundException e) {\n      return false; // file does not exist\n    } catch (IOException ioe) {\n      throw new IOException(E_FILE_CHECK_FAILED, ioe);\n    }","sourceCodeStart":326,"sourceCodeEnd":362,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/sftp/SFTPFileSystem.java#L326-L362","documentation":"Error \"Can't make directory for path %s since it is a file.\" thrown in apache/hadoop.","triggerScenarios":"Thrown by SFTPFileSystem.mkdirs when the target path already exists on the server as a regular file instead of a directory.","commonSituations":"See trigger scenarios.","solutions":["Choose a different path: a file already exists at the directory location.","Remove or rename the conflicting file before calling mkdirs."],"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"}