{"record":{"id":"8862aed689b25b97","repo":"badges/shields","slug":"no-versions-found-8862ae","errorCode":null,"errorMessage":"no versions found","messagePattern":"no versions found","errorType":"exception","errorClass":"InvalidResponse","httpStatus":null,"severity":"error","filePath":"services/maven-metadata/maven-metadata.service.js","lineNumber":110,"sourceCode":"      if (data.metadata.versioning.latest === undefined) {\n        throw new InvalidResponse({\n          prettyMessage: \"property 'latest' not found\",\n        })\n      }\n      return data.metadata.versioning.latest\n    } else if (strategy === 'releaseProperty') {\n      if (data.metadata.versioning.release === undefined) {\n        throw new InvalidResponse({\n          prettyMessage: \"property 'release' not found\",\n        })\n      }\n      return data.metadata.versioning.release\n    } else if (strategy === 'highestVersion') {\n      if (\n        data.metadata.versioning.versions?.version === undefined ||\n        data.metadata.versioning.versions?.version?.length === 0\n      ) {\n        throw new InvalidResponse({\n          prettyMessage: 'no versions found',\n        })\n      }\n      const versions = this.applyFilter({\n        versions: data.metadata.versioning.versions.version,\n        filter,\n      })\n      if (versions.length === 0) {\n        throw new NotFound({ prettyMessage: 'no matching versions found' })\n      }\n      return versions.sort(compare).reverse()[0]\n    }\n    throw new InvalidParameter({ prettyMessage: 'unknown strategy' })\n  }\n\n  async handle(\n    _namedParams,\n    { metadataUrl, versionPrefix, versionSuffix, strategy, filter },","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/badges/shields/blob/766fd8bc89a90b8534dc573ab72dec30215ab1ec/services/maven-metadata/maven-metadata.service.js#L92-L128","documentation":"Thrown for strategy 'highestVersion' when the metadata contains no version list: data.metadata.versioning.versions.version is undefined or an empty array. The library cannot determine a latest version from nothing, so it raises InvalidResponse with 'no versions found'.","triggerScenarios":"Calling getLatestVersion with strategy='highestVersion' (or a fallback reaching it) on maven-metadata.xml that has an empty <versions> element or none at all — e.g. a newly created, unpublished, or pruned artifact path.","commonSituations":"Requesting an artifact ID that exists but has no releases, wrong group/artifact path in the repo URL, a repository manager that purged old versions, or corrupted metadata XML.","solutions":["Verify the group/artifact path and repository URL are correct — an empty versions list often means the wrong artifact was queried.","Open the artifact's maven-metadata.xml in a browser and confirm <versions> contains entries.","Publish at least one version of the artifact, or restore pruned versions in the repository manager.","Choose a different strategy or treat the artifact as nonexistent in your calling code."],"exampleFix":"// before\nconst v = await service.getLatestVersion({ data, strategy: 'highestVersion' })\n// after\nconst versions = data.metadata.versioning.versions?.version ?? []\nif (versions.length === 0) return null\nconst v = await service.getLatestVersion({ data, strategy: 'highestVersion' })","handlingStrategy":"validation","validationCode":"const versions = data?.metadata?.versioning?.versions?.version\nif (!Array.isArray(versions) || versions.length === 0) {\n  return null // treat as artifact with no versions\n}","typeGuard":"function hasVersions(data) {\n  return Array.isArray(data?.metadata?.versioning?.versions?.version) && data.metadata.versioning.versions.version.length > 0\n}","tryCatchPattern":"try {\n  return await service.getLatestVersion({ data, strategy: 'highestVersion' })\n} catch (err) {\n  if (err && err.prettyMessage === 'no versions found') return null\n  throw err\n}","preventionTips":["Validate the group/artifact path and repo URL before fetching — empty versions often means wrong coordinates.","Check maven-metadata.xml in a browser to confirm the versions list exists.","Handle never-published artifacts explicitly in your data flow (return null/empty).","Distinguish repository purge/corruption issues from wrong-path issues in your monitoring."],"tags":["invalid-response","maven","metadata","empty-data"],"backgroundTag":"missing-metadata-field","analyzedSha":"766fd8bc89a90b8534dc573ab72dec30215ab1ec","analyzedAt":"2026-08-30T01:40:27.499Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}