{"record":{"id":"23212ff0b6a83845","repo":"gradle/gradle","slug":"inconsistent-module-metadata-found-descriptor-s","errorCode":null,"errorMessage":"inconsistent module metadata found. Descriptor: %s Errors: %s","messagePattern":"inconsistent module metadata found\\. Descriptor: (.+?) Errors: (.+?)","errorType":"exception","errorClass":"MetaDataParseException","httpStatus":null,"severity":"error","filePath":"platforms/software/dependency-management/src/main/java/org/gradle/api/internal/artifacts/repositories/metadata/AbstractRepositoryMetadataSource.java","lineNumber":126,"sourceCode":"        return sha1;\n    }\n\n    private ModuleDescriptorArtifactMetadata getMetaDataArtifactFor(ModuleComponentIdentifier moduleComponentIdentifier) {\n        IvyArtifactName ivyArtifactName = metadataArtifactProvider.getMetaDataArtifactName(moduleComponentIdentifier.getModule());\n        return new DefaultModuleDescriptorArtifactMetadata(moduleComponentIdentifier, ivyArtifactName);\n    }\n\n    void checkMetadataConsistency(ModuleComponentIdentifier expectedId, MutableModuleComponentResolveMetadata metadata) throws MetaDataParseException {\n        checkModuleIdentifier(expectedId, metadata.getModuleVersionId());\n    }\n\n    private void checkModuleIdentifier(ModuleComponentIdentifier expectedId, ModuleVersionIdentifier actualId) {\n        List<String> errors = new ArrayList<>();\n        checkEquals(\"group\", expectedId.getGroup(), actualId.getGroup(), errors);\n        checkEquals(\"module name\", expectedId.getModule(), actualId.getName(), errors);\n        checkEquals(\"version\", expectedId.getVersion(), actualId.getVersion(), errors);\n        if (errors.size() > 0) {\n            throw new MetaDataParseException(\n                    String.format(\"inconsistent module metadata found. Descriptor: %s Errors: %s\", actualId, joinLines(errors)));\n        }\n    }\n\n    private String joinLines(List<String> lines) {\n        return Joiner.on(SystemProperties.getInstance().getLineSeparator()).join(lines);\n    }\n\n    private void checkEquals(String label, String expected, String actual, List<String> errors) {\n        if (!expected.equals(actual)) {\n            errors.add(\"bad \" + label + \": expected='\" + expected + \"' found='\" + actual + \"'\");\n        }\n    }\n\n    protected abstract MetaDataParser.ParseResult<S> parseMetaDataFromResource(ModuleComponentIdentifier moduleComponentIdentifier, LocallyAvailableExternalResource cachedResource, ExternalResourceArtifactResolver artifactResolver, DescriptorParseContext context, String repoName);\n\n}\n","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/gradle/gradle/blob/534f27719b66953f95cc907aae7f2c1b12f5482d/platforms/software/dependency-management/src/main/java/org/gradle/api/internal/artifacts/repositories/metadata/AbstractRepositoryMetadataSource.java#L108-L144","documentation":"Thrown when Gradle parses a fetched module descriptor (POM, Ivy XML or Gradle .module file) and the group/module/version declared inside the descriptor do not match the coordinates that were requested. AbstractRepositoryMetadataSource.checkMetadataConsistency compares each part and collects every mismatch ('bad group/module name/version: expected vs found') into one MetaDataParseException. It exists to stop the dependency graph from accepting an artifact published under wrong coordinates.","triggerScenarios":"Resolving a module whose descriptor declares different coordinates than requested, e.g. requesting 'com.example:foo:1.0' when the POM says groupId 'com.example.bar'; a Maven relocation published incorrectly; a repository/mirror/content-filter that serves the wrong file for the requested module path.","commonSituations":"A library was renamed or moved but republished with stale descriptor coordinates; corporate proxy or repository filtering rule returning a different module; broken generatePom configuration on the publishing side; SNAPSHOT metadata drift.","solutions":["Read the 'bad group/module name/version: expected ... found ...' lines in the message, then fix the publishing side so the descriptor matches the coordinates it is published under.","If publishing is not under your control, change the dependency to the coordinates actually declared in the descriptor, or use dependency substitution / a component metadata rule to remap the module.","Verify that a mirror, proxy or repository content filtering is not serving the wrong artifact for the requested module path.","Check for accidental duplicate dependencies on both the old and relocated coordinates with conflicting versions."],"exampleFix":"// before: depending on stale coordinates that the descriptor no longer matches\nimplementation 'com.example:foo:1.0'\n// after: depend on the coordinates the descriptor actually declares (or fix the publisher)\nimplementation 'com.example:newgroup:foo:1.0'","handlingStrategy":"try-catch","validationCode":"def pom = new XmlSlurper().parseText(pomFile.text)\ndef actual = \"${pom.groupId.text()}:${pom.artifactId.text()}:${pom.version.text()}\"\nassert actual == requestedCoordinates : \"descriptor declares $actual, requested $requestedCoordinates\"","typeGuard":null,"tryCatchPattern":"try {\n  def files = config.resolvedConfiguration.lenientConfiguration\n} catch (Exception e) {\n  def cause = walkCauses(e).find { it.class.simpleName == 'MetaDataParseException' }\n  if (cause) { /* message lists bad group/module/version: fix publishing or remap dependency */ }\n  throw e\n}","preventionTips":["When publishing, verify descriptor coordinates match publication coordinates in a check task.","Avoid mirrors/content filters that rewrite artifact paths for module directories.","After renaming or moving a module, republish descriptors with the new coordinates."],"tags":["gradle","dependency-resolution","metadata","maven","ivy"],"backgroundTag":"module-metadata-mismatch","analyzedSha":"534f27719b66953f95cc907aae7f2c1b12f5482d","analyzedAt":"2026-08-22T08:09:12.375Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}