{"record":{"id":"dd2561b757fbc012","repo":"termux/termux-app","slug":"the-versionname-s-is-not-a-valid-version-as-per","errorCode":null,"errorMessage":"The versionName '%s' is not a valid version as per semantic version '2.0.0' spec in the format 'major.minor.patch(-prerelease)(+buildmetadata)'. https://semver.org/spec/v2.0.0.html.","messagePattern":"The versionName '(.+?)' is not a valid version as per semantic version '2\\.0\\.0' spec in the format 'major\\.minor\\.patch\\(-prerelease\\)\\(\\+buildmetadata\\)'\\. https://semver\\.org/spec/v2\\.0\\.0\\.html\\.","errorType":"validation","errorClass":"GradleException","httpStatus":null,"severity":"error","filePath":"app/build.gradle","lineNumber":164,"sourceCode":"}\n\ndependencies {\n    testImplementation \"junit:junit:4.13.2\"\n    testImplementation \"org.robolectric:robolectric:4.10\"\n    coreLibraryDesugaring \"com.android.tools:desugar_jdk_libs:1.1.5\"\n}\n\ntask versionName {\n    doLast {\n        print android.defaultConfig.versionName\n    }\n}\n\ndef validateVersionName(String versionName) {\n    // https://semver.org/spec/v2.0.0.html#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string\n    // ^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$\n    if (!java.util.regex.Pattern.matches(\"^(0|[1-9]\\\\d*)\\\\.(0|[1-9]\\\\d*)\\\\.(0|[1-9]\\\\d*)(?:-((?:0|[1-9]\\\\d*|\\\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\\\.(?:0|[1-9]\\\\d*|\\\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\\\+([0-9a-zA-Z-]+(?:\\\\.[0-9a-zA-Z-]+)*))?\\$\", versionName))\n        throw new GradleException(\"The versionName '\"  + versionName + \"' is not a valid version as per semantic version '2.0.0' spec in the format 'major.minor.patch(-prerelease)(+buildmetadata)'. https://semver.org/spec/v2.0.0.html.\")\n}\n\ndef downloadBootstrap(String arch, String expectedChecksum, String version) {\n    def digest = java.security.MessageDigest.getInstance(\"SHA-256\")\n\n    def localUrl = \"src/main/cpp/bootstrap-\" + arch + \".zip\"\n    def file = new File(projectDir, localUrl)\n    if (file.exists()) {\n        def buffer = new byte[8192]\n        def input = new FileInputStream(file)\n        while (true) {\n            def readBytes = input.read(buffer)\n            if (readBytes < 0) break\n            digest.update(buffer, 0, readBytes)\n        }\n        def checksum = new BigInteger(1, digest.digest()).toString(16)\n        while (checksum.length() < 64) { checksum = \"0\" + checksum }\n        if (checksum == expectedChecksum) {","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/termux/termux-app/blob/3df69d1da197dd9bd71a3bafd902dffd720576b4/app/build.gradle#L146-L182","documentation":"Thrown by the validateVersionName Gradle task when android.defaultConfig.versionName does not match the SemVer 2.0.0 regular expression. The format required is 'major.minor.patch' with optional '-prerelease' and '+buildmetadata'. Any deviation (missing patch, leading zeros like '01.2.3', non-numeric components, bad prerelease syntax) fails validation and halts the build.","triggerScenarios":"versionName is set to something like '1.2', 'v1.2.3', '1.02.3', '1.2.3.4', or contains characters not allowed in prerelease/build metadata segments. The regex is the official SemVer suggested one.","commonSituations":"Bumping the version and forgetting the patch number; prefixing with 'v'; using leading zeros in a numeric identifier; CI injecting a non-semver tag as versionName.","solutions":["Set versionName to a strict 'MAJOR.MINOR.PATCH' string, e.g. '0.118.0'.","Remove any 'v' prefix or non-numeric decorations from versionName.","Avoid leading zeros in numeric identifiers (use 0, not 00/01).","If using prerelease/build metadata, follow the allowed character sets in the regex."],"exampleFix":"// before\ndef versionName = \"v1.2\"\n// or\ndef versionName = \"1.02.3\"\n\n// after (strict semver)\ndef versionName = \"1.2.0\"","handlingStrategy":"validation","validationCode":"def SEMVER = ~/^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-.+)?(?:\\+.+)?$/\nif (!(versionName ==~ SEMVER)) {\n    throw new GradleException(\"versionName '${versionName}' is not valid semver\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep versionName strictly as 'MAJOR.MINOR.PATCH' with no 'v' prefix.","Avoid leading zeros in numeric identifiers.","Run validateVersionName in CI before publishing so a bad version fails the build early."],"tags":["gradle","build","versioning","semver","validation"],"backgroundTag":null,"analyzedSha":"3df69d1da197dd9bd71a3bafd902dffd720576b4","analyzedAt":"2026-08-13T22:46:28.294Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}