{"record":{"id":"59ad7c1274b0f7eb","repo":"quarkusio/quarkus","slug":"application-artifact-is-null","errorCode":null,"errorMessage":"Application artifact is null","messagePattern":"Application artifact is null","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/BootstrapAppModelResolver.java","lineNumber":317,"sourceCode":"                version = constraint.getArtifact().getVersion();\n            }\n            directDeps.add(new Dependency(\n                    new DefaultArtifact(d.getGroupId(), d.getArtifactId(), d.getClassifier(), null, version,\n                            mvn.getSession().getArtifactTypeRegistry().get(d.getType())),\n                    d.getScope(), d.isOptional(), toAetherExclusions(d.getExclusions())));\n        }\n\n        return buildAppModel(mainDep, mainArtifact, directDeps, mvn.getRepositories(), Set.of(), managedDeps);\n    }\n\n    private ApplicationModel doResolveModel(ArtifactCoords coords,\n            List<Dependency> directMvnDeps,\n            Set<ArtifactKey> excludedArtifacts,\n            ArtifactCoords managingProject,\n            Set<ArtifactKey> reloadableModules)\n            throws AppModelResolverException {\n        if (coords == null) {\n            throw new IllegalArgumentException(\"Application artifact is null\");\n        }\n        Artifact mvnArtifact = toAetherArtifact(coords);\n\n        Map<ArtifactKey, Dependency> managedDeps = null;\n        List<RemoteRepository> managedRepos = List.of();\n        if (managingProject != null) {\n            final ArtifactDescriptorResult managingDescr = mvn.resolveDescriptor(toAetherArtifact(managingProject));\n            managedDeps = DependencyUtils.toMap(managingDescr.getManagedDependencies());\n            managedRepos = mvn.newResolutionRepositories(managingDescr.getRepositories());\n        }\n\n        List<RemoteRepository> aggregatedRepos = mvn.aggregateRepositories(managedRepos, mvn.getRepositories());\n        final ResolvedDependencyBuilder appArtifact = resolve(coords, mvnArtifact, aggregatedRepos).setRuntimeCp();\n        mvnArtifact = toAetherArtifact(appArtifact);\n        final ArtifactDescriptorResult appArtifactDescr = resolveDescriptor(mvnArtifact, aggregatedRepos);\n\n        if (managedDeps != null && !managedDeps.isEmpty()) {\n            DependencyUtils.putAll(managedDeps, appArtifactDescr.getManagedDependencies());","sourceCodeStart":299,"sourceCodeEnd":335,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/BootstrapAppModelResolver.java#L299-L335","documentation":"doResolveModel requires the coordinates of the application artifact to resolve its dependency graph. A null coords argument is a caller programming error, thrown as an IllegalArgumentException before any Maven resolution is attempted.","triggerScenarios":"Any path into doResolveModel (e.g. via resolveManagedModel) where the ArtifactCoords parameter is null — typically an API caller passing an unset/failed-to-parse application artifact.","commonSituations":"Tooling code that derives app coordinates from configuration (quarkus.application.* or CLI args) and passes them on without a null check when the config value is absent.","solutions":["Ensure the caller supplies valid ArtifactCoords (groupId, artifactId, version) for the application before invoking resolveManagedModel/resolveModel APIs.","Check upstream parsing of the app artifact string; a null usually means the coordinate string was missing or failed to parse.","Add a guard/assertion in the calling code to fail early with a clear message."],"exampleFix":"// before\nresolver.resolveManagedModel(null, directDeps, ...);\n// after\nif (appCoords == null) { throw new IllegalArgumentException(\"app artifact coords must be set\"); }\nresolver.resolveManagedModel(appCoords, directDeps, ...);","handlingStrategy":"type-guard","validationCode":"Objects.requireNonNull(appCoords, \"Application artifact coordinates must not be null\");\nresolver.resolveManagedModel(appCoords, directDeps, excluded, managingProject, reloadable);","typeGuard":"static boolean isValidCoords(io.quarkus.maven.dependency.ArtifactCoords c) {\n    return c != null && c.getGroupId() != null && !c.getGroupId().isBlank()\n        && c.getArtifactId() != null && !c.getArtifactId().isBlank()\n        && c.getVersion() != null && !c.getVersion().isBlank();\n}","tryCatchPattern":"try {\n    model = resolver.resolveManagedModel(coords, ...);\n} catch (IllegalArgumentException e) {\n    if (\"Application artifact is null\".equals(e.getMessage())) {\n        throw new IllegalStateException(\"App artifact coords were not configured; check quarkus.application.* config\", e);\n    }\n    throw e;\n}","preventionTips":["Validate configuration-derived coordinates before calling resolver APIs.","Fail fast at configuration load time if the app artifact is undefined.","Prefer Optional handling over passing possibly-null coords through layers."],"tags":["null-check","api-misuse","bootstrap"],"backgroundTag":"null-required-argument","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"}