{"record":{"id":"de800e29461409c4","repo":"Tencent/matrix","slug":"invalid-version-fullversion","errorCode":null,"errorMessage":"Invalid version: ${fullVersion}","messagePattern":"Invalid version: (.+?)","errorType":"console","errorClass":"GradleException","httpStatus":null,"severity":"error","filePath":"matrix/matrix-android/gradle/WeChatPublish.gradle","lineNumber":159,"sourceCode":"        checkVersion()\n\n        if (!usedDefaultIsSnapshot) {\n            System.err.println 'isSnapshot should be avoided in build scripts.'\n        }\n\n        if (isSnapshot) {\n            // Bintray does not allow SNAPSHOT publish\n            publishToBintray = false\n        }\n\n        project.ext.fullVersion = fullVersion\n    }\n\n    private void checkVersion() {\n        if (!(fullVersion ==~ /\\d+\\.\\d+(?:\\.\\d+)?(?:\\.\\d+)?(?:-[\\w-]+)?/)) {\n            def message = \"Invalid version: ${fullVersion}\"\n            if (!isSnapshot)\n                throw new GradleException(message)\n            System.err.println(message)\n        }\n    }\n\n    final protected String getPublicationName() {\n        String result = \"\"\n        artifactId.split(\"[-_]\").each { result += it.capitalize() }\n        return uncapitalize(result)\n    }\n\n    protected void mountAdditionalLogic(project) {}\n\n    protected void emitPublicationDSL(Project project) {}\n\n    private void emitRepositoryDSL(Project project) {\n        mavenPublishClosures.each { cl ->\n            project.publishing.repositories {\n                maven {","sourceCodeStart":141,"sourceCodeEnd":177,"githubUrl":"https://github.com/Tencent/matrix/blob/3b8293bd65d47eeea7caf1f32a3a5d4d5eab60e7/matrix/matrix-android/gradle/WeChatPublish.gradle#L141-L177","documentation":"checkVersion() validates the fullVersion string (assembled from version + optional qualifiers) against the regex /\\d+\\.\\d+(?:\\.\\d+)?(?:\\.\\d+)?(?:-[\\w-]+)?/. For non-snapshot versions a mismatch throws a GradleException; for snapshot versions it only prints a warning to stderr so CI snapshot publishing can continue.","triggerScenarios":"project.version set to something like '1.0-abc!' , 'v2.3', '2', '1.0.RC1' (dot separators in qualifier), or any string not matching digits.digits[.digits][.digits][-qualifier] while isSnapshot is false.","commonSituations":"Setting version from an environment variable or git tag containing a leading 'v', using '.' instead of '-' in pre-release qualifiers (1.0.beta.1), or accidentally leaving the version empty.","solutions":["Fix project.version to match the required format, e.g. '1.2.3' or '1.2.3-beta-1' (use '-' before the qualifier)","Strip a leading 'v' or other decoration from versions derived from git tags/env vars before publishing","If the version is intentionally non-standard and this is a snapshot build, publish with isSnapshot so it only warns","Temporarily relax the regex in WeChatPublish.gradle if your org needs a different scheme (coordinate with consumers since it encodes publish coordinates)"],"exampleFix":"// before\nversion = 'v1.4.0'\n\n// after\nversion = '1.4.0'","handlingStrategy":"validation","validationCode":"// shell/groovy pre-check before invoking publish\ndef v = project.version as String\nassert v ==~ /\\d+\\.\\d+(?:\\.\\d+)?(?:\\.\\d+)?(?:-[\\w-]+)?/ : \"Version '$v' does not match required format\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Standardize release versions as MAJOR.MINOR[.PATCH][.BUILD][-qualifier]","Sanitize git-tag-derived versions (strip leading 'v') in CI","Use '-' not '.' for pre-release qualifiers","Smoke-test version parsing with a dry-run task before real publishing"],"tags":["gradle","versioning","validation"],"backgroundTag":"invalid-argument-format","analyzedSha":"3b8293bd65d47eeea7caf1f32a3a5d4d5eab60e7","analyzedAt":"2026-09-08T08:01:39.722Z","contentChangedAt":"2026-09-08T08:01:39.722Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}