{"record":{"id":"cb61201eade26543","repo":"quarkusio/quarkus","slug":"failed-to-determine-groupid-for-project-model","errorCode":null,"errorMessage":"Failed to determine groupId for project model","messagePattern":"Failed to determine groupId for project model","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/ModelUtils.java","lineNumber":142,"sourceCode":"                }\n            }\n            throw new IOException(\"Failed to located META-INF/maven/<groupId>/<artifactId>/pom.xml in \" + appJar);\n        }\n    }\n\n    public static String getGroupId(Model model) {\n        String groupId = model.getGroupId();\n        if (groupId != null) {\n            return groupId;\n        }\n        final Parent parent = model.getParent();\n        if (parent != null) {\n            groupId = parent.getGroupId();\n            if (groupId != null) {\n                return groupId;\n            }\n        }\n        throw new IllegalStateException(\"Failed to determine groupId for project model\");\n    }\n\n    /**\n     * Returns the raw version of the model. This method returns the result of {@link #getRawVersionOrNull(Model)}\n     * except if it's null, it throws an exception.\n     *\n     * @param model POM\n     * @return raw model\n     */\n    public static String getRawVersion(Model model) {\n        String version = getRawVersionOrNull(model);\n        if (version != null) {\n            return version;\n        }\n        throw new IllegalStateException(\"Failed to determine version for project model\");\n    }\n\n    /**","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/ModelUtils.java#L124-L160","documentation":"ModelUtils.getGroupId(Model) returns the model's groupId, falling back to the parent's groupId. If neither the model nor its parent declares a groupId, it throws IllegalStateException. A valid Maven POM resolved to coordinates must always have an effective groupId, so this indicates a structurally incomplete raw model.","triggerScenarios":"Calling ModelUtils.getGroupId on a raw (non-effective) Model parsed from a pom.xml whose project element declares neither <groupId> nor a <parent> with a <groupId> (e.g. a minimal/invalid pom.xml, or a MISSING_MODEL placeholder Model created with `new Model()`).","commonSituations":"Parsing a hand-written or generated minimal pom.xml lacking coordinates; reading a model from WorkspaceLoader.MISSING_MODEL (module without pom.xml handled as thirdparty); tools that construct Model objects programmatically without setting groupId.","solutions":["Add <groupId> to the project element of the pom.xml (or ensure its <parent> block has a groupId).","Validate the POM with `mvn help:effective-pom` or `mvn validate` before feeding it to the bootstrap.","In code, check model.getGroupId() == null && model.getParent() == null before calling getGroupId and treat the model as invalid."],"exampleFix":"<!-- before -->\n<project>\n  <artifactId>app</artifactId>\n  <version>1.0.0</version>\n</project>\n<!-- after -->\n<project>\n  <groupId>com.example</groupId>\n  <artifactId>app</artifactId>\n  <version>1.0.0</version>\n</project>","handlingStrategy":"validation","validationCode":"static boolean hasResolvableGroupId(Model model) {\n    return model.getGroupId() != null\n        || (model.getParent() != null && model.getParent().getGroupId() != null);\n}","typeGuard":"static boolean hasCoordinates(Model model) {\n    return model.getGroupId() != null || model.getParent() != null;\n}","tryCatchPattern":"try {\n    String g = ModelUtils.getGroupId(model);\n} catch (IllegalStateException e) {\n    // model declares neither groupId nor parent groupId — treat as invalid pom\n}","preventionTips":["Always declare <groupId> in the project or its <parent> block.","Run `mvn help:effective-pom` on generated/templated POMs before use.","When constructing Model objects in code, set groupId explicitly."],"tags":["maven","pom","invalid-model","quarkus-bootstrap"],"backgroundTag":"invalid-maven-pom","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"}