{"record":{"id":"2ae872d756189649","repo":"apache/flink","slug":"mkdirs-failed-to-create","errorCode":null,"errorMessage":"Mkdirs failed to create {}","messagePattern":"Mkdirs failed to create (.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"flink-core/src/main/java/org/apache/flink/core/fs/local/LocalFileSystem.java","lineNumber":261,"sourceCode":"        } else {\n            File parent = file.getParentFile();\n            return (parent == null || mkdirsInternal(parent))\n                    && (file.mkdir() || file.isDirectory());\n        }\n    }\n\n    @Override\n    public FSDataOutputStream create(final Path filePath, final WriteMode overwrite)\n            throws IOException {\n        checkNotNull(filePath, \"filePath\");\n\n        if (exists(filePath) && overwrite == WriteMode.NO_OVERWRITE) {\n            throw new FileAlreadyExistsException(\"File already exists: \" + filePath);\n        }\n\n        final Path parent = filePath.getParent();\n        if (parent != null && !mkdirs(parent)) {\n            throw new IOException(\"Mkdirs failed to create \" + parent);\n        }\n\n        final File file = pathToFile(filePath);\n        return new LocalDataOutputStream(file);\n    }\n\n    @Override\n    public boolean rename(final Path src, final Path dst) throws IOException {\n        final File srcFile = pathToFile(src);\n        final File dstFile = pathToFile(dst);\n\n        final File dstParent = dstFile.getParentFile();\n\n        // Files.move fails if the destination directory doesn't exist\n        //noinspection ResultOfMethodCallIgnored -- we don't care if the directory existed or was\n        // created\n        dstParent.mkdirs();\n","sourceCodeStart":243,"sourceCodeEnd":279,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-core/src/main/java/org/apache/flink/core/fs/local/LocalFileSystem.java#L243-L279","documentation":"Thrown by LocalFileSystem.create() when mkdirs(parent) returns false — meaning parent directory creation was attempted but reported failure (without throwing). This typically indicates the parent could not be created due to permissions or a conflicting file.","triggerScenarios":"Calling create(filePath) where filePath.getParent() is non-null and mkdirs(parent) returns false rather than throwing.","commonSituations":"Insufficient permissions to create the parent directory chain; a file already exists somewhere in the parent path; read-only mount; parent path on a volume that is full or read-only.","solutions":["Pre-create the parent directory manually and verify writability: `mkdir -p <parent>`.","Check and fix permissions on the parent path for the Flink user.","Ensure no regular file exists along the parent path.","Point the output to a writable, existing directory."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"void ensureParentWritable(Path filePath) throws IOException {\n    java.io.File parent = new File(filePath.getParent().toUri());\n    if (parent.exists() && !parent.isDirectory())\n        throw new IOException(\"Parent is not a directory: \" + parent);\n    if (!parent.canWrite()) throw new IOException(\"Parent not writable: \" + parent);\n}","typeGuard":null,"tryCatchPattern":"try {\n    fs.create(p, mode);\n} catch (IOException e) {\n    if (e.getMessage().startsWith(\"Mkdirs failed to create\")) {\n        // fix perms / pre-create parent, then retry\n    }\n    throw e;\n}","preventionTips":["Pre-create and chmod output parent directories.","Verify no file occupies any segment of the parent path.","Run jobs with users that have write access to the output root."],"tags":["filesystem","local-fs","mkdir","permissions","create"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}