{"record":{"id":"c70b2d957ef4ba07","repo":"apache/hadoop","slug":"could-not-find-any-valid-local-directory-for-pat","errorCode":null,"errorMessage":"Could not find any valid local directory for ${pathStr} with requested size ${size} on host ${hostname} as the max capacity in any directory (${pathNames} ) is ${maxCapacity}","messagePattern":"Could not find any valid local directory for (.+?) with requested size (.+?) on host (.+?) as the max capacity in any directory \\((.+?) \\) is (.+?)","errorType":"exception","errorClass":"DiskErrorException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/LocalDirAllocator.java","lineNumber":572,"sourceCode":"      }\n      if (returnPath != null) {\n        return returnPath;\n      }\n      \n      //no path found\n      String hostname = getHostname();\n      String newErrorText = \"Could not find any valid local directory for \"\n          + pathStr + \" with requested size \" + size\n          + \" on host \" + hostname\n          + \" as the max capacity in any directory\"\n          + \" (\" + pathNames + \" )\"\n          + \" is \" + maxCapacity;\n      if (errorText != null) {\n        newErrorText = newErrorText + \" due to \" + errorText;\n      }\n      LOG.error(newErrorText);\n      LOG.error(history.toString());\n      throw new DiskErrorException(newErrorText, diskException);\n    }\n\n    /** Creates a file on the local FS. Pass size as \n     * {@link LocalDirAllocator.SIZE_UNKNOWN} if not known apriori. We\n     *  round-robin over the set of disks (via the configured dirs) and return\n     *  a file on the first path which has enough space. The file is guaranteed\n     *  to go away when the JVM exits.\n     */\n    public File createTmpFileForWrite(String pathStr, long size, \n        Configuration conf) throws IOException {\n\n      // find an appropriate directory\n      Path path = getLocalPathForWrite(pathStr, size, conf, true);\n      File dir = new File(path.getParent().toUri().getPath());\n      String prefix = path.getName();\n\n      // create a temp file on this directory\n      File result = File.createTempFile(prefix, null, dir);","sourceCodeStart":554,"sourceCodeEnd":590,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/LocalDirAllocator.java#L554-L590","documentation":"Error \"Could not find any valid local directory for ${pathStr} with requested size ${size} on host ${hostname} as the max capacity in any directory (${pathNames} ) is ${maxCapacity}\" thrown in apache/hadoop.","triggerScenarios":"Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/LocalDirAllocator.java:572 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Request a smaller size or free space in the configured local directories.","Add larger-capacity directories to the local-dir configuration.","Review max capacity reporting; a nearly full disk triggers this even for modest requests."],"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-23T01:17:44.959Z"}