{"record":{"id":"cf8ae7ae447a6a38","repo":"quarkusio/quarkus","slug":"bad-identifier-formatted-with-artifactid-and-p","errorCode":null,"errorMessage":"${BAD_IDENTIFIER formatted with 'artifactId' and projectArtifactId}","messagePattern":"\\$\\{BAD_IDENTIFIER formatted with 'artifactId' and projectArtifactId\\}","errorType":"validation","errorClass":"MojoExecutionException","httpStatus":null,"severity":"error","filePath":"devtools/maven/src/main/java/io/quarkus/maven/CreateProjectMojo.java","lineNumber":292,"sourceCode":"                } catch (IOException e) {\n                    throw new MojoExecutionException(\"Could not access parent pom.\", e);\n                }\n            } else if (containsAtLeastOneGradleFile) {\n                throw new MojoExecutionException(\n                        \"You are trying to create a Maven project in a directory that contains only Gradle build files.\");\n            }\n        } else if (BuildTool.GRADLE.equals(buildToolEnum) || BuildTool.GRADLE_KOTLIN_DSL.equals(buildToolEnum)) {\n            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","sourceCodeStart":274,"sourceCodeEnd":310,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/devtools/maven/src/main/java/io/quarkus/maven/CreateProjectMojo.java#L274-L310","documentation":"After prompting for any missing values, the mojo validates the project artifactId against the OK_ID regex (a valid Maven/Java identifier pattern). If the user-supplied artifactId differs from the default and does not match, it throws a MojoExecutionException with the BAD_IDENTIFIER template formatted with 'artifactId' and the offending value. Maven identifiers cannot contain spaces, special characters, or start with invalid characters.","triggerScenarios":"`mvn quarkus:create -DprojectArtifactId=\"my app!\"` or typing an invalid artifactId at the interactive prompt.","commonSituations":"Artifact IDs with spaces, slashes, uppercase-with-symbols, trailing hyphens, or pasted paths pasted as the artifactId; scripts interpolating unvalidated names.","solutions":["Use a lowercase alphanumeric artifactId with hyphens only, e.g. -DprojectArtifactId=my-app","Re-run without the flag and accept the default, or fix at the interactive prompt","Sanitize the name in scripts before passing it (strip spaces/special characters)"],"exampleFix":"// before\nmvn quarkus:create -DprojectArtifactId=\"My App!\"\n// after\nmvn quarkus:create -DprojectArtifactId=my-app","handlingStrategy":"validation","validationCode":"Pattern OK_ID = Pattern.compile(\"^[a-zA-Z][a-zA-Z0-9_-]*$\");\nif (!OK_ID.matcher(artifactId).matches()) throw new IllegalArgumentException(\"Invalid artifactId: \" + artifactId);","typeGuard":null,"tryCatchPattern":"try {\n    runCreateGoal();\n} catch (MojoExecutionException e) {\n    if (e.getMessage().contains(\"artifactId\")) {\n        // retry with a sanitized identifier\n    }\n}","preventionTips":["Use lowercase letters, digits, and hyphens for artifactIds","Sanitize names in CI before passing -DprojectArtifactId","Never include spaces or path separators in identifiers"],"tags":["validation","naming-convention","maven"],"backgroundTag":"invalid-identifier","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"}