{"record":{"id":"64654456aba26e7e","repo":"quarkusio/quarkus","slug":"unable-to-create-the-project-the-directory-proj","errorCode":null,"errorMessage":"Unable to create the project, the directory ${projectRoot.getAbsolutePath()} already exists","messagePattern":"Unable to create the project, the directory (.+?) already exists","errorType":"exception","errorClass":"MojoExecutionException","httpStatus":null,"severity":"error","filePath":"devtools/maven/src/main/java/io/quarkus/maven/CreateProjectMojo.java","lineNumber":300,"sourceCode":"            if (containsAtLeastOneGradleFile) {\n                throw new MojoExecutionException(\"Adding subprojects to gradle projects is not implemented.\");\n            } else if (pom != null && pom.isFile()) {\n                throw new MojoExecutionException(\n                        \"You are trying to create gradle project in a directory that contains only maven build files.\");\n            }\n        }\n\n        askTheUserForMissingValues();\n        if (!DEFAULT_ARTIFACT_ID.equals(projectArtifactId) && !OK_ID.matcher(projectArtifactId).matches()) {\n            throw new MojoExecutionException(String.format(BAD_IDENTIFIER, \"artifactId\", projectArtifactId));\n        }\n        if (!DEFAULT_GROUP_ID.equals(projectGroupId) && !OK_ID.matcher(projectGroupId).matches()) {\n            throw new MojoExecutionException(String.format(BAD_IDENTIFIER, \"groupId\", projectGroupId));\n        }\n\n        projectRoot = new File(outputDirectory, projectArtifactId);\n        if (projectRoot.exists()) {\n            throw new MojoExecutionException(\"Unable to create the project, \" +\n                    \"the directory \" + projectRoot.getAbsolutePath() + \" already exists\");\n        }\n\n        boolean success;\n        final Path projectDirPath = projectRoot.toPath();\n        try {\n            extensions = CreateProjectHelper.sanitizeExtensions(extensions);\n            catalog = CreateProjectHelper.completeCatalog(catalog, extensions, mvn);\n            sanitizeOptions();\n\n            final List<ResourceLoader> codestartsResourceLoader = codestartLoadersBuilder(log)\n                    .catalog(catalog)\n                    .artifactResolver(mvn)\n                    .build();\n            QuarkusProject newProject = QuarkusProject.of(projectDirPath, catalog,\n                    codestartsResourceLoader, log, buildToolEnum, new JavaVersion(javaVersion));\n            final CreateProject createProject = new CreateProject(newProject)\n                    .groupId(projectGroupId)","sourceCodeStart":282,"sourceCodeEnd":318,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/devtools/maven/src/main/java/io/quarkus/maven/CreateProjectMojo.java#L282-L318","documentation":"The create goal computes the target project directory as outputDirectory/projectArtifactId. If that directory already exists on disk, scaffolding would overwrite or interleave with existing files, so the mojo refuses and throws this MojoExecutionException before writing anything.","triggerScenarios":"Re-running `mvn quarkus:create` with the same -DprojectArtifactId in the same outputDirectory after a previous successful (or partially successful) run.","commonSituations":"CI re-runs without cleaning the workspace; retrying after a failed generation that left the directory behind; choosing an artifactId that collides with an existing folder name.","solutions":["Delete the existing directory (rm -rf outputDirectory/artifactId) if its contents are disposable","Choose a different -DprojectArtifactId","Use a different -DoutputDirectory","Clean the CI workspace before rerunning the create step"],"exampleFix":"// before\nmvn quarkus:create -DprojectArtifactId=demo   # target/demo already exists\n// after\nrm -rf target/demo\nmvn quarkus:create -DprojectArtifactId=demo","handlingStrategy":"validation","validationCode":"File target = new File(outputDirectory, artifactId);\nif (target.exists()) {\n    if (allowOverwrite) deleteRecursively(target); else throw new IllegalStateException(\"Target exists: \" + target);\n}","typeGuard":null,"tryCatchPattern":"try {\n    runCreateGoal();\n} catch (MojoExecutionException e) {\n    if (e.getMessage().contains(\"already exists\")) {\n        // remove the directory or pick a new artifactId/outputDirectory\n    }\n}","preventionTips":["Clean CI workspaces before create-goal steps","Uniquely name projects per run (timestamp suffix) in automation","Check outputDirectory/projectArtifactId existence before invoking"],"tags":["filesystem","conflict","project-scaffolding"],"backgroundTag":"directory-already-exists","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"}