badges/shields · error · InvalidResponse
no versions found
Error message
no versions found
What it means
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'.
Source
Thrown at services/maven-metadata/maven-metadata.service.js:110
if (data.metadata.versioning.latest === undefined) {
throw new InvalidResponse({
prettyMessage: "property 'latest' not found",
})
}
return data.metadata.versioning.latest
} else if (strategy === 'releaseProperty') {
if (data.metadata.versioning.release === undefined) {
throw new InvalidResponse({
prettyMessage: "property 'release' not found",
})
}
return data.metadata.versioning.release
} else if (strategy === 'highestVersion') {
if (
data.metadata.versioning.versions?.version === undefined ||
data.metadata.versioning.versions?.version?.length === 0
) {
throw new InvalidResponse({
prettyMessage: 'no versions found',
})
}
const versions = this.applyFilter({
versions: data.metadata.versioning.versions.version,
filter,
})
if (versions.length === 0) {
throw new NotFound({ prettyMessage: 'no matching versions found' })
}
return versions.sort(compare).reverse()[0]
}
throw new InvalidParameter({ prettyMessage: 'unknown strategy' })
}
async handle(
_namedParams,
{ metadataUrl, versionPrefix, versionSuffix, strategy, filter },View on GitHub (pinned to 766fd8bc89)
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.
Example fix
// before
const v = await service.getLatestVersion({ data, strategy: 'highestVersion' })
// after
const versions = data.metadata.versioning.versions?.version ?? []
if (versions.length === 0) return null
const v = await service.getLatestVersion({ data, strategy: 'highestVersion' }) Defensive patterns
Strategy: validation
Validate before calling
const versions = data?.metadata?.versioning?.versions?.version
if (!Array.isArray(versions) || versions.length === 0) {
return null // treat as artifact with no versions
} Type guard
function hasVersions(data) {
return Array.isArray(data?.metadata?.versioning?.versions?.version) && data.metadata.versioning.versions.version.length > 0
} Try / catch
try {
return await service.getLatestVersion({ data, strategy: 'highestVersion' })
} catch (err) {
if (err && err.prettyMessage === 'no versions found') return null
throw err
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- property 'latest' not found
- property 'release' not found
- license not found
- no public giving stats
- no public receiving stats
AI-assisted analysis of badges/shields@766fd8bc89 (2026-08-30).
Data as JSON: /api/errors/8862aed689b25b97.
Report an issue: GitHub.