DIYgod/RSSHub · error · Error
Could not find component for ${group}:${artifact}: metadata
Error message
Could not find component for ${group}:${artifact}: metadata not found What it means
This error is thrown when the Maven Central metadata endpoint returns HTTP 404 for the constructed group/artifact path. It means the component does not exist in the repository at all — the directory structure was never created because the group:artifact coordinates are unknown to Maven Central.
Source
Thrown at lib/routes/maven/central.ts:75
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) => {
const href = $(element).attr('href') ?? '';
const version = href.replace('/', '');
const versionUrl = `https://central.sonatype.com/artifact/${group}/${artifact}/${version}`;
View on GitHub (pinned to bed535e087)
Solutions
- Confirm the group:artifact coordinates on https://central.sonatype.com/ or search.maven.org.
- Check character case — Maven group IDs are case-sensitive.
- If the artifact lives in another repo (Spring milestones, JBoss, JitPack), use that repo's feed instead of Maven Central.
- Copy the dependency XML from the project's own documentation rather than typing coordinates manually.
Example fix
// before // /maven/central/com.google.guava/guava-bad -> 404 // after // /maven/central/com.google.guava/guava
Defensive patterns
Strategy: validation
Validate before calling
// HEAD-check the artifact existence before subscribing
const res = await fetch(`https://repo1.maven.org/maven2/${group.replaceAll('.', '/')}/${artifact}/maven-metadata.xml`, { method: 'HEAD' });
if (!res.ok) { /* artifact missing */ } Type guard
function isMavenCoordinates(input: string): boolean {
// group:artifact, group has >=1 dot typically, no slashes
return /^[a-zA-Z0-9_.-]+:[a-zA-Z0-9_.-]+$/.test(input);
} Try / catch
try {
await ofetch(metadataUrl);
} catch (error) {
if (error?.response?.status === 404) return { item: [], allowEmpty: true };
throw error;
} Prevention
- Source coordinates from Maven Central's search API rather than typing them.
- Use HEAD requests to pre-validate artifact existence in tooling.
- Distinguish 404 (missing) from 200-empty (malformed) in error handling.
When it happens
Trigger: ofetch(maven-metadata.xml) rejects with an error whose response.status === 404. This is the canonical 'artifact not found' signal from Maven Central for any misspelled or non-existent group:artifact pair.
Common situations: Typo in group ID (e.g. 'org.springFramework' wrong case); using a package name from a different repo (Gradle plugins, JitPack, internal Nexus); artifact removed from Central; confusion between Maven group ID and Node.js package name.
Related errors
- Not a valid component for ${group}:${artifact}: versions not
- id 为 ${catalogId} 的 List 不存在
- Invalid type parameter
- unknown site: ${site}
- Invalid type parameter
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/a7fbba6ef7dc3136.
Report an issue: GitHub.