{"record":{"id":"6ad1af23010137cd","repo":"apache/maven","slug":"unable-to-resolve-artifacts","errorCode":null,"errorMessage":"Unable to resolve artifacts: ","messagePattern":"Unable to resolve artifacts: ","errorType":"exception","errorClass":"ArtifactResolverException","httpStatus":null,"severity":"error","filePath":"impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultArtifactResolver.java","lineNumber":131,"sourceCode":"                    List<ResolverResult> res = new ArrayList<>(resolverResults.size());\n                    for (int i = 0; i < resolverResults.size(); i++) {\n                        res.add(new ResolverResult(list.get(i), resolverResults.get(i)));\n                    }\n                    return res;\n                } catch (ArtifactResolutionException e) {\n                    throw new MavenExecutionException(e);\n                }\n            });\n\n            return toResult(request, results.stream());\n        } catch (BatchRequestException e) {\n            String message;\n            if (e.getResults().size() == 1) {\n                message = e.getResults().iterator().next().error().getMessage();\n            } else {\n                message = \"Unable to resolve artifacts: \" + e.getMessage();\n            }\n            throw new ArtifactResolverException(message, e, toResult(request, e));\n        } finally {\n            RequestTraceHelper.exit(trace);\n        }\n    }\n\n    ArtifactResolverResult toResult(ArtifactResolverRequest request, BatchRequestException exception) {\n        return toResult(\n                request,\n                exception.getResults().stream()\n                        .map(rr -> {\n                            if (rr.result() != null) {\n                                return rr.result();\n                            } else if (rr.error() != null) {\n                                return new ResolverResult(null, ((ArtifactResolutionException) rr.error()).getResult());\n                            } else {\n                                throw new IllegalStateException(\"Unexpected result: \" + rr);\n                            }\n                        })","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/apache/maven/blob/e4093d4e120eac99d6bdce5ba67cace2f3085c97/impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultArtifactResolver.java#L113-L149","documentation":"DefaultArtifactResolver.resolve wraps resolution failures of one or more artifacts in ArtifactResolverException. When exactly one artifact was requested the message is that artifact's own error (usually 'could not be found' or a transfer failure); with multiple artifacts the message is prefixed 'Unable to resolve artifacts:' and the per-artifact errors are available through the attached ArtifactResolverResult (built from the BatchRequestException results).","triggerScenarios":"session.getService(ArtifactResolver.class).resolve(ArtifactResolverRequest with one or more ProducedArtifact/coordinates) where at least one artifact is missing from all configured repositories, unreachable, or its checksum/validation fails. For a single artifact the first result's error message is surfaced verbatim.","commonSituations":"Dependency not in central nor in configured private repos (typo in groupId/artifactId/version); offline mode or VPN/proxy blocking the repo; 401 on authenticated pulls; version exists only in a repository not listed; local repository cache corrupted (.lastUpdated files blocking re-attempt).","solutions":["Read the per-artifact errors from the ArtifactResolverResult attached to the exception to see which coordinates failed and why","Fix the coordinates or add the missing repository to the session/request repositories","Check settings.xml mirrors/proxies and network access to the repository URLs; if a pull was rejected earlier, clear stale .lastUpdated markers in the local repo (or run with -U equivalent)","For authenticated repos, add matching <server> credentials in settings.xml"],"exampleFix":"// before\nArtifactResolverResult r = session.getService(ArtifactResolver.class).resolve(request);\n\n// after\ntry {\n    ArtifactResolverResult r = session.getService(ArtifactResolver.class).resolve(request);\n} catch (ArtifactResolverException e) {\n    e.getResult().artifacts().forEach(a -> log.error('resolved: ' + a));\n    throw e;\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    ArtifactResolverResult result = session.getService(ArtifactResolver.class).resolve(request);\n} catch (ArtifactResolverException e) {\n    // single artifact: e.getMessage() is the per-artifact error\n    // multiple: inspect e.getResult() for per-artifact outcomes, then report coordinates + cause\n}","preventionTips":["Validate coordinates (groupId/artifactId/version) before resolving","Ensure needed repositories and credentials are configured in the session and settings.xml","For batch resolves, read per-artifact results from the exception's result instead of guessing which one failed"],"tags":["maven","dependency-resolution","remote-repository","network"],"backgroundTag":"dependency-resolution-failed","analyzedSha":"e4093d4e120eac99d6bdce5ba67cace2f3085c97","analyzedAt":"2026-08-21T22:58:24.034Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}