{"record":{"id":"4251b5e8a4ebd6f2","repo":"quarkusio/quarkus","slug":"coords-is-not-a-pom","errorCode":null,"errorMessage":"${coords} is not a POM","messagePattern":"(.+?) is not a POM","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/project/buildfile/MavenBuildFile.java","lineNumber":61,"sourceCode":"    public MavenBuildFile(final Path projectDirPath, ExtensionCatalog catalog) {\n        super(projectDirPath, catalog);\n    }\n\n    @Override\n    public void writeToDisk() throws IOException {\n        if (getModel() == null) {\n            return;\n        }\n        try (ByteArrayOutputStream pomOutputStream = new ByteArrayOutputStream()) {\n            MojoUtils.write(getModel(), pomOutputStream);\n            writeToProjectFile(BuildTool.MAVEN.getDependenciesFile(), pomOutputStream.toByteArray());\n        }\n    }\n\n    @Override\n    protected boolean importBom(ArtifactCoords coords) {\n        if (!ArtifactCoords.TYPE_POM.equals(coords.getType())) {\n            throw new IllegalArgumentException(coords + \" is not a POM\");\n        }\n        Model model = getModel();\n        final Dependency d = new Dependency();\n        d.setGroupId(coords.getGroupId());\n        d.setArtifactId(coords.getArtifactId());\n        d.setType(coords.getType());\n        d.setScope(io.quarkus.maven.dependency.Dependency.SCOPE_IMPORT);\n        DependencyManagement dependencyManagement = model.getDependencyManagement();\n        if (dependencyManagement == null) {\n            dependencyManagement = new DependencyManagement();\n            model.setDependencyManagement(dependencyManagement);\n        }\n        if (dependencyManagement.getDependencies()\n                .stream()\n                .map(this::toResolvedDependency)\n                .noneMatch(thisDep -> d.getManagementKey().equals(thisDep.getManagementKey()))) {\n            dependencyManagement.addDependency(d);\n            return true;","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/project/buildfile/MavenBuildFile.java#L43-L79","documentation":"MavenBuildFile.importBom only supports importing BOMs, i.e. artifacts whose packaging type is 'pom'. If the passed ArtifactCoords has any other type, it throws IllegalArgumentException naming the offending coordinates. This is an argument-validation guard against adding a non-BOM artifact as a bom import in pom.xml.","triggerScenarios":"Calling MavenBuildFile.importBom(coords) with an ArtifactCoords whose getType() is 'jar' (the default) or anything other than 'pom', e.g. ArtifactCoords.of(\"io.quarkus\",\"quarkus-bom\",null,null,\"jar\").","commonSituations":"Constructing ArtifactCoords from a 'groupId:artifactId:version' string, which defaults type to 'jar', and passing it to importBom without overriding the type to 'pom'.","solutions":["Set the type on the coordinates to 'pom' before calling importBom (coords.withType(ArtifactCoords.TYPE_POM) or build with type=\"pom\")","If the goal is to add a regular dependency, use addDependency instead of importBom","Verify the artifact string parsed into ArtifactCoords actually represents a BOM packaging"],"exampleFix":"// before\ncoords = ArtifactCoords.fromString(\"io.quarkus.platform:quarkus-bom:3.2.0.Final\"); // type defaults to jar\nbuildFile.importBom(coords);\n// after\ncoords = ArtifactCoords.fromString(\"io.quarkus.platform:quarkus-bom:pom:3.2.0.Final\");\nbuildFile.importBom(coords);","handlingStrategy":"validation","validationCode":"if (!ArtifactCoords.TYPE_POM.equals(coords.getType())) {\n    throw new IllegalArgumentException(\"importBom requires type=pom, got: \" + coords.getType());\n}","typeGuard":"boolean isBomCoords(ArtifactCoords coords) {\n    return coords != null && ArtifactCoords.TYPE_POM.equals(coords.getType());\n}","tryCatchPattern":"try {\n    buildFile.importBom(coords);\n} catch (IllegalArgumentException e) {\n    if (!e.getMessage().endsWith(\"is not a POM\")) throw e;\n    // convert coordinates to type 'pom' and retry, or use addDependency\n}","preventionTips":["Always set type=pom on ArtifactCoords before importBom","Use coords.withType(ArtifactCoords.TYPE_POM) when parsing from 'g:a:v' strings","Use addDependency for non-BOM artifacts","Validate the artifact's packaging in the repository before import"],"tags":["maven","argument-validation","bom"],"backgroundTag":"invalid-artifact-type","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"}