{"record":{"id":"a7fbba6ef7dc3136","repo":"DIYgod/RSSHub","slug":"could-not-find-component-for-group-artifact","errorCode":null,"errorMessage":"Could not find component for ${group}:${artifact}: metadata not found","messagePattern":"Could not find component for (.+?):(.+?): metadata not found","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"lib/routes/maven/central.ts","lineNumber":75,"sourceCode":"    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) => {\n            const href = $(element).attr('href') ?? '';\n            const version = href.replace('/', '');\n            const versionUrl = `https://central.sonatype.com/artifact/${group}/${artifact}/${version}`;\n","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/maven/central.ts#L57-L93","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\n// /maven/central/com.google.guava/guava-bad  -> 404\n\n// after\n// /maven/central/com.google.guava/guava","handlingStrategy":"validation","validationCode":"// HEAD-check the artifact existence before subscribing\nconst res = await fetch(`https://repo1.maven.org/maven2/${group.replaceAll('.', '/')}/${artifact}/maven-metadata.xml`, { method: 'HEAD' });\nif (!res.ok) { /* artifact missing */ }","typeGuard":"function isMavenCoordinates(input: string): boolean {\n    // group:artifact, group has >=1 dot typically, no slashes\n    return /^[a-zA-Z0-9_.-]+:[a-zA-Z0-9_.-]+$/.test(input);\n}","tryCatchPattern":"try {\n    await ofetch(metadataUrl);\n} catch (error) {\n    if (error?.response?.status === 404) return { item: [], allowEmpty: true };\n    throw error;\n}","preventionTips":["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."],"tags":["maven","http","user-input","not-found"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}