{"record":{"id":"da2f21237eb4404c","repo":"badges/shields","slug":"artifact-or-versiontype-version-not-found","errorCode":null,"errorMessage":"artifact or ${versionType}version not found","messagePattern":"artifact or (.+?)version not found","errorType":"exception","errorClass":"NotFound","httpStatus":404,"severity":"error","filePath":"services/nexus/nexus.service.js","lineNumber":155,"sourceCode":"\n    const json = await this._requestJson(\n      this.authHelper.withBasicAuth({\n        schema: searchApiSchema,\n        url,\n        options: { searchParams },\n        httpErrors: {\n          404: 'artifact not found',\n        },\n      }),\n    )\n\n    return { json }\n  }\n\n  transform({ repo, json }) {\n    if (json.items.length === 0) {\n      const versionType = repo === 's' ? 'snapshot ' : ''\n      throw new NotFound({\n        prettyMessage: `artifact or ${versionType}version not found`,\n      })\n    }\n    return { version: json.items[0].version }\n  }\n\n  async handle({ repo, groupId, artifactId }, { server, queryOpt }) {\n    const { json } = await this.fetch({\n      repo,\n      server,\n      groupId,\n      artifactId,\n      queryOpt,\n    })\n\n    const { version } = this.transform({ repo, json })\n    return renderVersionBadge({ version })\n  }","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/badges/shields/blob/766fd8bc89a90b8534dc573ab72dec30215ab1ec/services/nexus/nexus.service.js#L137-L173","documentation":"Thrown by the Nexus service's transform() when the Nexus search API returns zero items, meaning no artifact matching repo/package (and version constraints) exists. For snapshot repositories (`repo === 's'`) the message reads 'artifact or snapshot version not found', otherwise 'artifact or version not found'. It is a NotFound, so it renders as the badge's 'not found' state rather than an upstream/server error.","triggerScenarios":"Querying a Nexus 3 search endpoint for a package name that does not exist in the repo; requesting a release version from a snapshot repo or vice versa; a version filter that matches nothing; wrong repository id ('s' vs 'r') for the artifact.","commonSituations":"Typo'd groupId/artifactId; artifact published only as snapshots but queried with the release repo parameter; Nexus instance migrated and repository IDs changed; private repo without the artifact.","solutions":["Verify the artifact exists in the target Nexus repository via its search UI or /service/rest/v1/search","Confirm you are passing the correct repo parameter ('s' for snapshots, 'r' for releases)","Check the package name/groupId:artifactId spelling and URL-encoding","Relax any version filter/prefix so at least one version matches"],"exampleFix":"// before\n/nexus/s/my.group/wrong-artifact.svg\n// after\n/nexus/s/my.group/correct-artifact.svg  (artifact published to the snapshot repo)","handlingStrategy":"fallback","validationCode":"// Pre-check existence via Nexus search API before rendering\nconst res = await fetch(`${nexusUrl}/service/rest/v1/search?repository=${repo}&maven.group=${group}&maven.artifactId=${artifact}`)\nconst { items } = await res.json()\nif (!items || items.length === 0) throw new Error(`artifact not found in repo ${repo}`)","typeGuard":"function hasResults(json) {\n  return json != null && Array.isArray(json.items) && json.items.length > 0\n}","tryCatchPattern":"try {\n  return await nexusBadge({ repo, pkg })\n} catch (e) {\n  if (e instanceof NotFound && /not found$/.test(e.message)) {\n    return renderPlaceholderBadge('artifact not found')\n  }\n  throw e\n}","preventionTips":["Confirm the artifact exists in the exact repository (snapshot vs release) before generating badges","Double-check groupId:artifactId spelling and URL-encoding","Keep a build-time check that fails your CI if the referenced artifact disappears from Nexus","Map repo parameter ('s'/'r') to the correct Nexus repository id in one shared helper"],"tags":["not-found","nexus","maven","upstream"],"backgroundTag":"package-not-found","analyzedSha":"766fd8bc89a90b8534dc573ab72dec30215ab1ec","analyzedAt":"2026-08-30T01:40:27.499Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}