{"record":{"id":"cea7150a8dc98a20","repo":"jackwener/OpenCLI","slug":"goproxy-version-value-is-not-a-valid-go-sem","errorCode":null,"errorMessage":"goproxy --version \"${value}\" is not a valid Go semver tag","messagePattern":"goproxy --version \"(.+?)\" is not a valid Go semver tag","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/goproxy/utils.js","lineNumber":40,"sourceCode":"        throw new ArgumentError(\n            'goproxy module path is required (e.g. \"github.com/gin-gonic/gin\", \"golang.org/x/net\")',\n            'Use the canonical module path that appears in `go.mod`.',\n        );\n    }\n    if (!MODULE_PATH.test(s) || !s.includes('/')) {\n        throw new ArgumentError(\n            `goproxy module path \"${value}\" is not a recognised Go module path`,\n            'Module paths look like \"github.com/<org>/<repo>\" or \"golang.org/x/<name>\".',\n        );\n    }\n    return s;\n}\n\nexport function requireVersionTag(value) {\n    const s = String(value ?? '').trim();\n    if (!s) throw new ArgumentError('goproxy --version cannot be empty');\n    if (!VERSION_TAG.test(s)) {\n        throw new ArgumentError(\n            `goproxy --version \"${value}\" is not a valid Go semver tag`,\n            'Use the GOPROXY canonical form like \"v1.2.3\" or \"v0.0.0-20240101010101-abcdef012345\".',\n        );\n    }\n    return s;\n}\n\nexport function requireBoundedInt(value, defaultValue, maxValue, label = 'limit') {\n    const raw = value ?? defaultValue;\n    const n = typeof raw === 'number' ? raw : Number(raw);\n    if (!Number.isInteger(n) || n <= 0) {\n        throw new ArgumentError(`goproxy ${label} must be a positive integer`);\n    }\n    if (n > maxValue) {\n        throw new ArgumentError(`goproxy ${label} must be <= ${maxValue}`);\n    }\n    return n;\n}","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/goproxy/utils.js#L22-L58","documentation":"Thrown by requireVersionTag at clis/goproxy/utils.js:40 when the value does not match VERSION_TAG = /^v[0-9]+(\\.[0-9]+)*([-+][A-Za-z0-9._-]+)?$/. Only GOPROXY canonical tags — 'v' prefix, dot-separated numbers, optional pre-release/build suffix — are accepted.","triggerScenarios":"Passing '1.2.3' (missing v prefix), 'v1' style is fine but 'v1.x' is not, 'latest', 'master', a git SHA, 'v1.2.3.4-beta ' with trailing whitespace inside the match attempt, or tags with invalid suffix characters (e.g. spaces, '/').","commonSituations":"Dropping the 'v' that Go's release process always adds; passing branch names or 'latest'; copying a full tag annotation like 'release-v1.2.3'; using versions from non-Go ecosystems (e.g. npm's '1.2.3').","solutions":["Prefix the version with 'v': '1.2.3' → 'v1.2.3'.","List valid tags via the proxy itself (`https://proxy.golang.org/<module>/@v/list`) or `go list -m -versions <module>` and use one verbatim.","Remove branch names/SHAs — only released semver tags exist on the GOPROXY.","Strip whitespace and ensure the suffix after '-' or '+' uses only [A-Za-z0-9._-]."],"exampleFix":"// before\nrequireVersionTag('1.2.3');\n// after\nrequireVersionTag('v1.2.3');","handlingStrategy":"validation","validationCode":"const VERSION_TAG = /^v[0-9]+(\\.[0-9]+)*([-+][A-Za-z0-9._-]+)?$/;\nfunction validateTag(v) {\n  const s = String(v ?? '').trim();\n  if (!VERSION_TAG.test(s)) throw new Error(`not a Go semver tag: ${s}`);\n  return s;\n}\nvalidateTag(input);","typeGuard":"const isGoSemverTag = (v) =>\n  typeof v === 'string' && /^v[0-9]+(\\.[0-9]+)*([-+][A-Za-z0-9._-]+)?$/.test(v.trim());","tryCatchPattern":"try {\n  const tag = requireVersionTag(raw);\n} catch (err) {\n  if (err instanceof ArgumentError && /not a valid Go semver tag/.test(err.message)) {\n    console.error(`'${raw}' is not a Go tag — expected forms: v1.2.3 or v0.0.0-20240101010101-abcdef012345`);\n  } else throw err;\n}","preventionTips":["Always include the leading 'v' — Go release tags are always v-prefixed.","Resolve tags from `go list -m -versions <module>` rather than typing them by hand.","Do not pass branch names, SHAs, or 'latest' where a semver tag is expected."],"tags":["argument-error","input-validation","goproxy","semver"],"backgroundTag":"invalid-version-string","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}