{"record":{"id":"dcceb74167337061","repo":"gradle/gradle","slug":"supplied-s-does-not-match-ivy-descriptor-cannot","errorCode":null,"errorMessage":"supplied %s does not match ivy descriptor (cannot edit %1$s directly in the ivy descriptor file).","messagePattern":"supplied (.+?) does not match ivy descriptor \\(cannot edit %1\\$s directly in the ivy descriptor file\\)\\.","errorType":"validation","errorClass":"InvalidIvyPublicationException","httpStatus":null,"severity":"error","filePath":"platforms/software/ivy/src/main/java/org/gradle/api/publish/ivy/internal/publisher/ValidatingIvyPublisher.java","lineNumber":160,"sourceCode":"    private void checkCanPublish(String name, IvyArtifact artifact) {\n        File artifactFile = artifact.getFile();\n        if (artifactFile.isDirectory()) {\n            throw new InvalidIvyPublicationException(name, String.format(\"artifact file is a directory: '%s'\", artifactFile));\n        }\n    }\n\n    private IvyFieldValidator field(IvyNormalizedPublication publication, String name, String value) {\n        return new IvyFieldValidator(publication.getName(), name, value);\n    }\n\n    private static class IvyFieldValidator extends PublicationFieldValidator<IvyFieldValidator> {\n        private IvyFieldValidator(String publicationName, String name, String value) {\n            super(IvyFieldValidator.class, publicationName, name, value);\n        }\n\n        public IvyFieldValidator matches(String expectedValue) {\n            if (!value.equals(expectedValue)) {\n                throw new InvalidIvyPublicationException(publicationName,\n                        String.format(\"supplied %s does not match ivy descriptor (cannot edit %1$s directly in the ivy descriptor file).\", name)\n                );\n            }\n            return this;\n        }\n\n        @Override\n        protected InvalidUserDataException failure(String message) {\n            throw new InvalidIvyPublicationException(publicationName, message);\n        }\n    }\n}\n","sourceCodeStart":142,"sourceCodeEnd":173,"githubUrl":"https://github.com/gradle/gradle/blob/534f27719b66953f95cc907aae7f2c1b12f5482d/platforms/software/ivy/src/main/java/org/gradle/api/publish/ivy/internal/publisher/ValidatingIvyPublisher.java#L142-L173","documentation":"Before upload, ValidatingIvyPublisher re-parses the generated ivy.xml and compares its identity fields (organisation, module name, revision) with the publication coordinates. IvyFieldValidator.matches throws this when a field differs: identity fields cannot be changed by editing the ivy descriptor file.","triggerScenarios":"publication.descriptor.withXml rewriting the <info> organisation/module/revision attributes; changing publication.organisation/version after the descriptor was generated; a stale ivy.xml left in the build directory from an earlier configuration; hand-editing the generated descriptor between generation and publish.","commonSituations":"Scripts that patch descriptor identity via withXml instead of setting publication properties; CI reusing a dirty build directory after changing project version or coordinates; plugins that rewrite ivy.xml metadata.","solutions":["Set organisation/module/revision on the IvyPublication itself, never via withXml","Delete the stale descriptor and regenerate: ./gradlew clean generateDescriptorFileForIvyPublication","Remove any withXml block that rewrites <info> identity and mirror the change on publication properties"],"exampleFix":"// before\npublication.descriptor.withXml {\n    asNode().info[0].'@organisation' = 'com.correct' // rejected at publish time\n}\n\n// after\npublication.organisation = 'com.correct'","handlingStrategy":"validation","validationCode":"gradle.taskGraph.whenReady { graph ->\n    def pub = publishing.publications.findByName('ivy')\n    if (pub != null && graph.hasTask(pub.publishTasks.first())) {\n        assert pub.organisation == project.group : 'publication organisation drifted from project.group'\n        assert pub.revision == project.version.toString() : 'publication revision drifted from project.version'\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat ivy.xml identity as generated output - never edit it directly","Derive publication coordinates from one source (project.group/version) and set them on the publication","Run clean builds in CI so stale descriptors cannot be published"],"tags":["gradle","ivy","publishing","descriptor","coordinates"],"backgroundTag":"metadata-identity-mismatch","analyzedSha":"534f27719b66953f95cc907aae7f2c1b12f5482d","analyzedAt":"2026-08-22T08:09:12.375Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}