{"record":{"id":"72573ce99458e466","repo":"DIYgod/RSSHub","slug":"not-a-valid-component-for-group-artifact-ve","errorCode":null,"errorMessage":"Not a valid component for ${group}:${artifact}: versions not found","messagePattern":"Not a valid component for (.+?):(.+?): versions not found","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"lib/routes/maven/central.ts","lineNumber":71,"sourceCode":"const DATE_REGEX = /(\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2})/;\n\nasync function handler(ctx) {\n    const group = ctx.req.param('group');\n    const artifact = ctx.req.param('artifact');\n    const limit = ctx.req.query('limit') ? Number(ctx.req.query('limit')) : 15;\n\n    // (org.springframework, spring-core) -> org/springframework/spring-core\n    const identifier = `${group.replaceAll('.', '/')}/${artifact}`;\n\n    try {\n        const metadataUrl = `https://repo1.maven.org/maven2/${identifier}/maven-metadata.xml`;\n        const metadataResponse = await ofetch(metadataUrl);\n\n        const $meta = load(metadataResponse, { xmlMode: true });\n        const latestVersion = $meta('metadata > versioning > latest').text();\n\n        if (!latestVersion) {\n            throw new Error(`Not a valid component for ${group}:${artifact}: versions not found`);\n        }\n    } catch (error: any) {\n        if (error?.response?.status === 404) {\n            throw new Error(`Could not find component for ${group}:${artifact}: metadata not found`, { cause: error });\n        }\n        throw error;\n    }\n\n    const response = await ofetch(`https://repo1.maven.org/maven2/${identifier}/`);\n    const $ = load(response);\n\n    const items = $('pre#contents a')\n        .toArray()\n        .filter((element) => {\n            const href = $(element).attr('href') ?? '';\n            return href.endsWith('/') && href !== '../';\n        })\n        .map((element) => {","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/maven/central.ts#L53-L89","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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)."],"exampleFix":"// before\nconst group = 'org.springframework';\nconst artifact = 'spring-core-bad'; // wrong artifact\n\n// after — verify coordinates exist on Maven Central first\nconst group = 'org.springframework';\nconst artifact = 'spring-core';","handlingStrategy":"validation","validationCode":"// Validate the metadata has a latest version before relying on it\nconst $meta = load(metadataResponse, { xmlMode: true });\nconst latestVersion = $meta('metadata > versioning > latest').text().trim();\nif (!latestVersion) {\n    throw new Error(`No usable version in metadata for ${group}:${artifact}`);\n}","typeGuard":"function hasVersioning($meta: ReturnType<typeof load>): boolean {\n    const latest = $meta('metadata > versioning > latest').text().trim();\n    const versions = $meta('metadata > versioning > versions > version').toArray();\n    return latest.length > 0 || versions.length > 0;\n}","tryCatchPattern":"try {\n    // fetch + parse metadata\n} catch (error) {\n    if (error?.response?.status === 404) {\n        // artifact truly missing — return empty feed, not a hard error\n    }\n    throw error;\n}","preventionTips":["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."],"tags":["maven","validation","user-input","http"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}