DIYgod/RSSHub · error · Error
Not a valid component for ${group}:${artifact}: versions not
Error message
Not a valid component for ${group}:${artifact}: versions not found What it means
This error is thrown by the Maven Central route when the maven-metadata.xml file is successfully fetched (HTTP 200) but the <metadata><versioning><latest> element is empty or absent. It indicates the group:artifact path resolves to a real Maven repository directory, but the metadata XML does not declare a version — meaning the component is malformed, deprecated, or only has a placeholder metadata file.
Source
Thrown at lib/routes/maven/central.ts:71
const DATE_REGEX = /(\d{4}-\d{2}-\d{2} \d{2}:\d{2})/;
async function handler(ctx) {
const group = ctx.req.param('group');
const artifact = ctx.req.param('artifact');
const limit = ctx.req.query('limit') ? Number(ctx.req.query('limit')) : 15;
// (org.springframework, spring-core) -> org/springframework/spring-core
const identifier = `${group.replaceAll('.', '/')}/${artifact}`;
try {
const metadataUrl = `https://repo1.maven.org/maven2/${identifier}/maven-metadata.xml`;
const metadataResponse = await ofetch(metadataUrl);
const $meta = load(metadataResponse, { xmlMode: true });
const latestVersion = $meta('metadata > versioning > latest').text();
if (!latestVersion) {
throw new Error(`Not a valid component for ${group}:${artifact}: versions not found`);
}
} catch (error: any) {
if (error?.response?.status === 404) {
throw new Error(`Could not find component for ${group}:${artifact}: metadata not found`, { cause: error });
}
throw error;
}
const response = await ofetch(`https://repo1.maven.org/maven2/${identifier}/`);
const $ = load(response);
const items = $('pre#contents a')
.toArray()
.filter((element) => {
const href = $(element).attr('href') ?? '';
return href.endsWith('/') && href !== '../';
})
.map((element) => {View on GitHub (pinned to bed535e087)
Solutions
- Verify the exact group:artifact on https://central.sonatype.com/ — copy the coordinates directly.
- Check the raw maven-metadata.xml in a browser to confirm it contains <versioning><latest>; if empty, the artifact is not publishable here.
- If the artifact relocated, use the new group:artifact (maven-metadata.xml often lists <relocation>).
- Switch to a different Maven repository if the artifact is hosted elsewhere (e.g. Spring milestones, JitPack).
Example fix
// before const group = 'org.springframework'; const artifact = 'spring-core-bad'; // wrong artifact // after — verify coordinates exist on Maven Central first const group = 'org.springframework'; const artifact = 'spring-core';
Defensive patterns
Strategy: validation
Validate before calling
// Validate the metadata has a latest version before relying on it
const $meta = load(metadataResponse, { xmlMode: true });
const latestVersion = $meta('metadata > versioning > latest').text().trim();
if (!latestVersion) {
throw new Error(`No usable version in metadata for ${group}:${artifact}`);
} Type guard
function hasVersioning($meta: ReturnType<typeof load>): boolean {
const latest = $meta('metadata > versioning > latest').text().trim();
const versions = $meta('metadata > versioning > versions > version').toArray();
return latest.length > 0 || versions.length > 0;
} Try / catch
try {
// fetch + parse metadata
} catch (error) {
if (error?.response?.status === 404) {
// artifact truly missing — return empty feed, not a hard error
}
throw error;
} Prevention
- Validate coordinates on central.sonatype.com before subscribing.
- Cache a successful metadata check so transient empty responses don't propagate.
- Treat an empty <latest> as 'feed unavailable' and return allowEmpty rather than throwing for feed-reader resilience.
When it happens
Trigger: A GET to https://repo1.maven.org/maven2/<group-as-path>/<artifact>/maven-metadata.xml returns 200, but the parsed XML's metadata > versioning > latest selector yields an empty string. This happens for relocated artifacts, artifacts with only a parent pom, or abandoned projects whose metadata was auto-generated without versions.
Common situations: Typo in group/artifact that accidentally matches a directory but not a real published artifact; using a group ID with wrong segment count; artifact was deleted but the directory/metadata stub remains; querying a multi-module parent pom that never published versions itself.
Related errors
- Could not find component for ${group}:${artifact}: metadata
- Invalid type parameter
- unknown site: ${site}
- Invalid type parameter
- Invalid category: ${category}
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/72573ce99458e466.
Report an issue: GitHub.