{"record":{"id":"5ba3114f73ebbe7e","repo":"quarkusio/quarkus","slug":"failed-to-create-classesdir-5ba311","errorCode":null,"errorMessage":"Failed to create ${classesDir}","messagePattern":"Failed to create (.+?)","errorType":"exception","errorClass":"MojoExecutionException","httpStatus":null,"severity":"error","filePath":"devtools/maven/src/main/java/io/quarkus/maven/QuarkusProjectStateMojoBase.java","lineNumber":108,"sourceCode":"\n    private void ensureResolvableModule(DependencyNode node, LocalWorkspace workspace, List<Path> createdDirs)\n            throws MojoExecutionException {\n        Artifact artifact = node.getArtifact();\n        if (artifact != null) {\n            final LocalProject module = workspace.getProject(artifact.getGroupId(), artifact.getArtifactId());\n            if (module != null && !module.getRawModel().getPackaging().equals(ArtifactCoords.TYPE_POM)) {\n                final Path classesDir = module.getClassesDir();\n                if (!Files.exists(classesDir)) {\n                    Path topDirToCreate = classesDir;\n                    while (!Files.exists(topDirToCreate.getParent())) {\n                        topDirToCreate = topDirToCreate.getParent();\n                    }\n                    try {\n                        Files.createDirectories(classesDir);\n                        // We keep the root target dir because it is used to store the update recipes\n                        //createdDirs.add(topDirToCreate);\n                    } catch (IOException e) {\n                        throw new MojoExecutionException(\"Failed to create \" + classesDir, e);\n                    }\n                }\n            }\n        }\n        for (DependencyNode c : node.getChildren()) {\n            ensureResolvableModule(c, workspace, createdDirs);\n        }\n    }\n\n    @Override\n    protected MavenArtifactResolver catalogArtifactResolver() throws MojoExecutionException {\n        if (getLog().isDebugEnabled()) {\n            return artifactResolver();\n        } else {\n            try {\n                final MavenArtifactResolver baseResolver = artifactResolver();\n                final DefaultRepositorySystemSession session = new DefaultRepositorySystemSession(\n                        baseResolver.getSession());","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/devtools/maven/src/main/java/io/quarkus/maven/QuarkusProjectStateMojoBase.java#L90-L126","documentation":"This MojoExecutionException is thrown by QuarkusProjectStateMojoBase.ensureResolvableModule when Files.createDirectories(classesDir) fails with an IOException. The mojo pre-creates target/classes directories for workspace modules so that the application model resolver can treat them as resolvable; filesystem permission problems or invalid paths cause this failure.","triggerScenarios":"Creating target/classes under a workspace module when the target directory is read-only, owned by another user, a file occupies the path, or the derived path is invalid (e.g. special characters in module name).","commonSituations":"Running Maven in a container as non-root against a root-owned checkout; read-only CI workspace; disk full; target/ replaced by a symlink to an unwritable location.","solutions":["Check and fix filesystem permissions on the project's target directories (chown/chmod or run as the workspace owner)","Ensure the path target/classes is a directory, not a regular file or broken symlink; remove and recreate target/","Free disk space if the volume is full and re-run the goal","Run the command inside the same container/user that owns the workspace"],"exampleFix":"# before\nmvn quarkus:update  (fails: Failed to create /workspace/app/target/classes)\n# after\nsudo chown -R $(id -u):$(id -g) /workspace/app/target && mvn quarkus:update","handlingStrategy":"validation","validationCode":"Path classesDir = Paths.get(\"target\", \"classes\");\nif (Files.exists(classesDir) && !Files.isDirectory(classesDir)) {\n    Files.delete(classesDir); // a file occupies the path\n}\nif (!Files.isWritable(classesDir.getParent())) {\n    throw new IllegalStateException(\"target/ is not writable: check permissions/disk space\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    Files.createDirectories(classesDir);\n} catch (IOException e) {\n    // check permissions, disk space, and that no file blocks the path, then retry\n}","preventionTips":["Run builds as a user that owns the workspace","Never leave a regular file at target/classes","Monitor disk space on build agents","Clean stale target/ directories between container/user switches"],"tags":["filesystem","io","permissions","maven"],"backgroundTag":"directory-creation-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"}