{"record":{"id":"6e0775732d42fb06","repo":"jackwener/OpenCLI","slug":"maven-central-has-no-published-versions-for-coor","errorCode":null,"errorMessage":"Maven Central has no published versions for ${coordLabel}.","messagePattern":"Maven Central has no published versions for (.+?)\\.","errorType":"exception","errorClass":"EmptyResultError","httpStatus":null,"severity":"error","filePath":"clis/maven/artifact.js","lineNumber":37,"sourceCode":"    browser: false,\n    args: [\n        { name: 'coordinate', positional: true, required: true, help: 'Maven coord \"groupId:artifactId\" or \"groupId:artifactId:version\"' },\n        { name: 'limit', type: 'int', default: 20, help: 'Max versions (1-200, ignored when version is pinned)' },\n    ],\n    columns: ['groupId', 'artifactId', 'version', 'packaging', 'publishedAt', 'tags', 'url'],\n    func: async (args) => {\n        const { groupId, artifactId, version } = requireCoord(args.coordinate);\n        const limit = requireBoundedInt(args.limit, 20, 200);\n        const filters = [`g:${groupId}`, `a:${artifactId}`];\n        if (version) filters.push(`v:${version}`);\n        const q = filters.join(' AND ');\n        const rows = version ? 1 : limit;\n        const url = `${MAVEN_BASE}?q=${encodeURIComponent(q)}&core=gav&rows=${rows}&wt=json`;\n        const body = await mavenFetch(url, 'maven artifact');\n        const docs = Array.isArray(body?.response?.docs) ? body.response.docs : [];\n        const coordLabel = version ? `${groupId}:${artifactId}:${version}` : `${groupId}:${artifactId}`;\n        if (!docs.length) {\n            throw new EmptyResultError('maven artifact', `Maven Central has no published versions for ${coordLabel}.`);\n        }\n        return docs.map((d) => ({\n            groupId: String(d.g ?? groupId).trim(),\n            artifactId: String(d.a ?? artifactId).trim(),\n            version: String(d.v ?? '').trim(),\n            packaging: String(d.p ?? '').trim(),\n            publishedAt: epochMsToIso(d.timestamp),\n            tags: Array.isArray(d.tags) ? d.tags.filter(Boolean).join(', ') : '',\n            url: `https://central.sonatype.com/artifact/${groupId}/${artifactId}/${d.v ?? ''}`.replace(/\\/$/, ''),\n        }));\n    },\n});\n","sourceCodeStart":19,"sourceCodeEnd":50,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/maven/artifact.js#L19-L50","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before (typo + pinned nonexistent version)\n$ maven artifact org.springframework:spring-core:9.9.9\n// EmptyResultError: Maven Central has no published versions for org.springframework:spring-core:9.9.9.\n\n// after (correct coord, list versions)\n$ maven artifact org.springframework:spring-core","handlingStrategy":"validation","validationCode":"// validate the coordinate before querying\nconst COORD = /^([\\w.-]+):([\\w.-]+)(?::([\\w.-]+))?$/;\nfunction checkCoordinate(coord) {\n  const m = COORD.exec(coord.trim());\n  if (!m) throw new Error(`Bad Maven coordinate: ${coord}`);\n  return { groupId: m[1], artifactId: m[2], version: m[3] };\n}","typeGuard":"const isMavenCoordinate = (s) => /^[\\w.-]+:[\\w.-]+(:[\\w.-]+)?$/.test(typeof s === 'string' ? s.trim() : '');","tryCatchPattern":"try {\n  const rows = await run('maven artifact', coord);\n} catch (e) {\n  if (e instanceof EmptyResultError) {\n    console.error(`${coord} not on Maven Central — check spelling at central.sonatype.com or query the artifact's actual repository.`);\n  } else throw e;\n}","preventionTips":["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."],"tags":["empty-result","not-found","maven","registry"],"backgroundTag":"artifact-not-found","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}