jackwener/OpenCLI · error · ArgumentError
goproxy --version "${value}" is not a valid Go semver tag
Error message
goproxy --version "${value}" is not a valid Go semver tag What it means
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.
Source
Thrown at clis/goproxy/utils.js:40
throw new ArgumentError(
'goproxy module path is required (e.g. "github.com/gin-gonic/gin", "golang.org/x/net")',
'Use the canonical module path that appears in `go.mod`.',
);
}
if (!MODULE_PATH.test(s) || !s.includes('/')) {
throw new ArgumentError(
`goproxy module path "${value}" is not a recognised Go module path`,
'Module paths look like "github.com/<org>/<repo>" or "golang.org/x/<name>".',
);
}
return s;
}
export function requireVersionTag(value) {
const s = String(value ?? '').trim();
if (!s) throw new ArgumentError('goproxy --version cannot be empty');
if (!VERSION_TAG.test(s)) {
throw new ArgumentError(
`goproxy --version "${value}" is not a valid Go semver tag`,
'Use the GOPROXY canonical form like "v1.2.3" or "v0.0.0-20240101010101-abcdef012345".',
);
}
return s;
}
export function requireBoundedInt(value, defaultValue, maxValue, label = 'limit') {
const raw = value ?? defaultValue;
const n = typeof raw === 'number' ? raw : Number(raw);
if (!Number.isInteger(n) || n <= 0) {
throw new ArgumentError(`goproxy ${label} must be a positive integer`);
}
if (n > maxValue) {
throw new ArgumentError(`goproxy ${label} must be <= ${maxValue}`);
}
return n;
}View on GitHub (pinned to 49907e53dc)
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._-].
Example fix
// before
requireVersionTag('1.2.3');
// after
requireVersionTag('v1.2.3'); Defensive patterns
Strategy: validation
Validate before calling
const VERSION_TAG = /^v[0-9]+(\.[0-9]+)*([-+][A-Za-z0-9._-]+)?$/;
function validateTag(v) {
const s = String(v ?? '').trim();
if (!VERSION_TAG.test(s)) throw new Error(`not a Go semver tag: ${s}`);
return s;
}
validateTag(input); Type guard
const isGoSemverTag = (v) => typeof v === 'string' && /^v[0-9]+(\.[0-9]+)*([-+][A-Za-z0-9._-]+)?$/.test(v.trim());
Try / catch
try {
const tag = requireVersionTag(raw);
} catch (err) {
if (err instanceof ArgumentError && /not a valid Go semver tag/.test(err.message)) {
console.error(`'${raw}' is not a Go tag — expected forms: v1.2.3 or v0.0.0-20240101010101-abcdef012345`);
} else throw err;
} Prevention
- 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.
When it happens
Trigger: 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, '/').
Common situations: 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').
Related errors
- goproxy --version cannot be empty
- goproxy module path is required (e.g. "github.com/gin-gonic/
- goproxy module path "${value}" is not a recognised Go module
- goproxy ${label} must be a positive integer
- goproxy ${label} must be <= ${maxValue}
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/cea7150a8dc98a20.
Report an issue: GitHub.