{"record":{"id":"a9b874436edcf456","repo":"quarkusio/quarkus","slug":"cannot-create-directory-directory","errorCode":null,"errorMessage":"Cannot create directory ${directory}","messagePattern":"Cannot create directory (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"core/deployment/src/main/java/io/quarkus/deployment/dev/filesystem/QuarkusFileManager.java","lineNumber":66,"sourceCode":"                // Paths might be missing! (see: https://github.com/quarkusio/quarkus/issues/42908)\n                ensureDirectories(context.getAnnotationProcessorPaths());\n                this.fileManager.setLocation(StandardLocation.ANNOTATION_PROCESSOR_PATH, context.getAnnotationProcessorPaths());\n            }\n        } catch (IOException e) {\n            throw new RuntimeException(\"Cannot reset file manager\", e);\n        }\n    }\n\n    private void ensureDirectories(Iterable<File> directories) {\n        for (File directory : directories) {\n            ensureDirectory(directory);\n        }\n    }\n\n    private void ensureDirectory(File directory) {\n        if (!directory.exists()) {\n            if (!directory.mkdirs()) {\n                throw new RuntimeException(\"Cannot create directory \" + directory);\n            }\n        }\n    }\n\n    @Override\n    public void close() throws IOException {\n        super.close();\n    }\n\n    public static class Context {\n        private final Set<File> classPath;\n        private final Set<File> reloadableClassPath;\n        private final File outputDirectory;\n        private final Charset sourceEncoding;\n        private final boolean ignoreModuleInfo;\n        private final File generatedSourcesDirectory;\n        private final Set<File> annotationProcessorPaths;\n","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/core/deployment/src/main/java/io/quarkus/deployment/dev/filesystem/QuarkusFileManager.java#L48-L84","documentation":"Thrown by QuarkusFileManager.ensureDirectory when File.mkdirs() fails to create a required directory on disk during live-reload/dev-mode file manager setup. This is a filesystem-level failure: the process could not create the directory, usually because of permissions, an existing non-directory file at that path, or a full/failed disk.","triggerScenarios":"Java calling ensureDirectories/reset on QuarkusFileManager while dev-mode working directories (e.g. under target/) cannot be created because mkdirs() returns false.","commonSituations":"Read-only workspace or CI volume; a file named like the expected directory exists at the path; disk quota exceeded; running dev mode as a user without write access to the project root; NFS/Windows path conflicts.","solutions":["Check the parent path: delete or rename any file that occupies the target directory path","Run the build/dev-mode with a user that has write permissions to the project and target directories","Free disk space or raise quota if the disk is full","Set a writable quarkus dev-mode working directory / run from a writable checkout"],"exampleFix":"// before: running dev mode in a read-only container\nFROM ... USER nobody\n// after: mount workspace writable or run as a user with write access\nUSER quarkus\nRUN mkdir -p /workspace && chown quarkus /workspace","handlingStrategy":"validation","validationCode":"File dir = new File(path);\nif (!dir.exists() && (dir.getParentFile() == null || !dir.getParentFile().canWrite() || (dir.exists() && !dir.isDirectory()))) {\n    throw new IllegalStateException(\"Cannot create directory \" + dir + \": parent not writable or path occupied by a file\");\n}","typeGuard":"static boolean canCreateDir(File d) {\n    if (d.isDirectory()) return true;\n    File parent = d.getAbsoluteFile().getParentFile();\n    return parent != null && parent.canWrite();\n}","tryCatchPattern":"try {\n    ensureDirectories();\n} catch (RuntimeException e) {\n    if (e.getMessage().startsWith(\"Cannot create directory\")) {\n        // check permissions/disk for the path in the message\n    }\n    throw e;\n}","preventionTips":["Verify the dev-mode working directories are writable before starting quarkus:dev (especially in CI containers)","Never place a regular file where a directory is expected (e.g. a file named 'classes')","Monitor disk space/quota on build machines","Run builds as a dedicated user with ownership of the workspace"],"tags":["filesystem","io","dev-mode"],"backgroundTag":"mkdir-failed","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}