jackwener/OpenCLI · error · EmptyResultError
Maven Central has no published versions for ${coordLabel}.
Error message
Maven Central has no published versions for ${coordLabel}. What it means
The `maven artifact` command queries Maven Central's Solr `gav` core with `g:<groupId> AND a:<artifactId>` (and `v:<version>` when pinned). If the response contains no docs, it throws this EmptyResultError stating that Maven Central has no published versions for the given coordinate. The search service responded successfully — there simply were no matching version rows.
Source
Thrown at clis/maven/artifact.js:37
browser: false,
args: [
{ name: 'coordinate', positional: true, required: true, help: 'Maven coord "groupId:artifactId" or "groupId:artifactId:version"' },
{ name: 'limit', type: 'int', default: 20, help: 'Max versions (1-200, ignored when version is pinned)' },
],
columns: ['groupId', 'artifactId', 'version', 'packaging', 'publishedAt', 'tags', 'url'],
func: async (args) => {
const { groupId, artifactId, version } = requireCoord(args.coordinate);
const limit = requireBoundedInt(args.limit, 20, 200);
const filters = [`g:${groupId}`, `a:${artifactId}`];
if (version) filters.push(`v:${version}`);
const q = filters.join(' AND ');
const rows = version ? 1 : limit;
const url = `${MAVEN_BASE}?q=${encodeURIComponent(q)}&core=gav&rows=${rows}&wt=json`;
const body = await mavenFetch(url, 'maven artifact');
const docs = Array.isArray(body?.response?.docs) ? body.response.docs : [];
const coordLabel = version ? `${groupId}:${artifactId}:${version}` : `${groupId}:${artifactId}`;
if (!docs.length) {
throw new EmptyResultError('maven artifact', `Maven Central has no published versions for ${coordLabel}.`);
}
return docs.map((d) => ({
groupId: String(d.g ?? groupId).trim(),
artifactId: String(d.a ?? artifactId).trim(),
version: String(d.v ?? '').trim(),
packaging: String(d.p ?? '').trim(),
publishedAt: epochMsToIso(d.timestamp),
tags: Array.isArray(d.tags) ? d.tags.filter(Boolean).join(', ') : '',
url: `https://central.sonatype.com/artifact/${groupId}/${artifactId}/${d.v ?? ''}`.replace(/\/$/, ''),
}));
},
});
View on GitHub (pinned to 49907e53dc)
Solutions
- Verify the exact groupId and artifactId (copy from the artifact's POM or central.sonatype.com) and retry.
- If pinning a version, drop the `:version` segment to list all versions and pick from the output.
- Check the artifact exists on central.sonatype.com manually; it may only be on another repository (JBoss, Google Maven, a private registry) and need a different source.
- Wait a few minutes and retry if the artifact was just published (indexing lag).
- Remember snapshots and artifacts only in local/private repos won't appear — query the appropriate repository instead.
Example fix
// before (typo + pinned nonexistent version) $ maven artifact org.springframework:spring-core:9.9.9 // EmptyResultError: Maven Central has no published versions for org.springframework:spring-core:9.9.9. // after (correct coord, list versions) $ maven artifact org.springframework:spring-core
Defensive patterns
Strategy: validation
Validate before calling
// validate the coordinate before querying
const COORD = /^([\w.-]+):([\w.-]+)(?::([\w.-]+))?$/;
function checkCoordinate(coord) {
const m = COORD.exec(coord.trim());
if (!m) throw new Error(`Bad Maven coordinate: ${coord}`);
return { groupId: m[1], artifactId: m[2], version: m[3] };
} Type guard
const isMavenCoordinate = (s) => /^[\w.-]+:[\w.-]+(:[\w.-]+)?$/.test(typeof s === 'string' ? s.trim() : '');
Try / catch
try {
const rows = await run('maven artifact', coord);
} catch (e) {
if (e instanceof EmptyResultError) {
console.error(`${coord} not on Maven Central — check spelling at central.sonatype.com or query the artifact's actual repository.`);
} else throw e;
} Prevention
- Copy coordinates from the artifact's POM or central.sonatype.com rather than typing them.
- Omit the `:version` segment first to list available versions, then pin one from that output.
- Remember Maven Central only hosts release artifacts — snapshots and internal builds live elsewhere.
- Allow a few minutes of indexing lag when querying freshly published artifacts.
When it happens
Trigger: Querying a groupId:artifactId that does not exist on Maven Central, a typo in either segment, an artifact hosted only on JBoss/GitHub Packages/Google Maven (not Central), or pinning a :version that was never published for that artifact.
Common situations: Internal/company artifacts that never made it to Central; typos like `org.springfamework` instead of `org.springframework`; checking a very recently published artifact before Solr indexing completes; querying an old artifact whose groupId changed after relocation; snapshot versions which are not served from Central.
Related errors
- Maven Central returned 404 for ${url}.
- bilibili creator-stats ${bvid}
- Chess.com returned 404 for ${url}
- crates crate
- crates.io returned 404 for ${url}.
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/6e0775732d42fb06.
Report an issue: GitHub.