{"record":{"id":"62edaea078a60145","repo":"quarkusio/quarkus","slug":"unable-to-create-directory-directory","errorCode":null,"errorMessage":"Unable to create directory: ${directory}","messagePattern":"Unable to create directory: (.+?)","errorType":"exception","errorClass":"MojoExecutionException","httpStatus":null,"severity":"error","filePath":"devtools/config-doc-maven-plugin/src/main/java/io/quarkus/maven/config/doc/GenerateConfigDocMojo.java","lineNumber":270,"sourceCode":"\n    private static String generateAllConfig(Engine quteEngine, Context context,\n            Map<Extension, Map<ConfigRootKey, ConfigRoot>> configRootsByExtensions) {\n        return quteEngine.getTemplate(\"allConfig\")\n                .data(\"configRootsByExtensions\", configRootsByExtensions)\n                .data(\"searchable\", true)\n                .data(\"context\", context)\n                .data(\"summaryTableId\", context.summaryTableId()) // for backward compatibility, use context instead\n                .data(\"additionalAnchorPrefix\", \"\")\n                .data(\"includeDurationNote\", true)\n                .data(\"includeMemorySizeNote\", true)\n                .render();\n    }\n\n    private static void initTargetDirectory(Path resolvedTargetDirectory) throws MojoExecutionException {\n        try {\n            Files.createDirectories(resolvedTargetDirectory);\n        } catch (IOException e) {\n            throw new MojoExecutionException(\"Unable to create directory: \" + resolvedTargetDirectory, e);\n        }\n    }\n\n    static List<Path> findTargetDirectories(Path scanDirectory) throws MojoExecutionException {\n        try {\n            List<Path> targets = new ArrayList<>();\n\n            Files.walkFileTree(scanDirectory, new SimpleFileVisitor<>() {\n\n                @Override\n                public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {\n                    if (dir.endsWith(TARGET)) {\n                        // we check if there is a POM around as it might happen that the target/ directory is still around\n                        // while the module has been dropped\n                        if (Files.exists(dir.resolve(\"../pom.xml\"))) {\n                            targets.add(dir);\n                        }\n","sourceCodeStart":252,"sourceCodeEnd":288,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/devtools/config-doc-maven-plugin/src/main/java/io/quarkus/maven/config/doc/GenerateConfigDocMojo.java#L252-L288","documentation":"initTargetDirectory creates the plugin's output directory with Files.createDirectories and converts an IOException into a MojoExecutionException naming the directory. The build stops because documentation cannot be written without it.","triggerScenarios":"generateConfigDoc runs with a targetDirectory that cannot be created: parent path is a file, permissions deny write, path is invalid on the filesystem, or disk is full.","commonSituations":"Absolute paths from Windows-style config on Linux CI; read-only Docker build containers; a file already occupies a path segment of the directory.","solutions":["Check the configured targetDirectory path is valid and its parent is writable","Remove any file that occupies a segment of the path","Run the build in a writable location (e.g. under target/) instead of a read-only mount"],"exampleFix":"// before\n<targetDirectory>/opt/docs</targetDirectory>  <!-- read-only mount -->\n// after\n<targetDirectory>${project.build.directory}/generated-docs</targetDirectory>","handlingStrategy":"validation","validationCode":"Path dir = Paths.get(targetDirectory);\nPath parent = dir.toAbsolutePath().getParent();\nif (parent == null || !Files.isWritable(parent)) {\n    throw new IllegalStateException(\"Cannot create dir: \" + dir);\n}\nif (Files.exists(dir) && !Files.isDirectory(dir)) {\n    throw new IllegalStateException(\"Path is a file: \" + dir);\n}","typeGuard":null,"tryCatchPattern":"try {\n    mojo.execute();\n} catch (MojoExecutionException e) {\n    if (e.getMessage().startsWith(\"Unable to create directory\")) {\n        // check permissions / path before retrying\n    }\n}","preventionTips":["Default to ${project.build.directory}/... paths","Never point output at read-only mounts","Verify CI containers run as a user with write access"],"tags":["maven","filesystem","io"],"backgroundTag":"directory-not-writable","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}