{"record":{"id":"2ffdb9549ee7cdfc","repo":"jackwener/OpenCLI","slug":"goproxy-version-cannot-be-empty","errorCode":null,"errorMessage":"goproxy --version cannot be empty","messagePattern":"goproxy --version cannot be empty","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/goproxy/utils.js","lineNumber":38,"sourceCode":"    const s = String(value ?? '').trim();\n    if (!s) {\n        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    }","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/goproxy/utils.js#L20-L56","documentation":"Thrown by requireVersionTag at clis/goproxy/utils.js:38 when the --version value is missing or empty after trimming. The adapter needs a concrete Go semver tag to hit endpoints like @v/<ver>.info, so an empty version is rejected immediately.","triggerScenarios":"Calling requireVersionTag(''), requireVersionTag(undefined/null), or the CLI invoked with --version given no value; a config lookup returning an empty string.","commonSituations":"Scripting with an unset variable (e.g. $VERSION empty); forgetting the flag value (`goproxy --version` with nothing after it); a build tool emitting an empty tag field.","solutions":["Supply a concrete tag like 'v1.2.3' — check the repo's tags with `git tag -l` or `go list -m -versions <module>`.","If you want the newest release, omit the version filter rather than passing an empty value, so the adapter can query @latest.","Guard variables in scripts: fail early with a clear message if $VERSION is empty."],"exampleFix":"// before\nconst info = await goproxyVersionInfo(mod, process.env.VERSION);\n// after\nconst tag = process.env.VERSION || 'v1.9.1';\nconst info = await goproxyVersionInfo(mod, requireVersionTag(tag));","handlingStrategy":"validation","validationCode":"if (!process.env.VERSION || !process.env.VERSION.trim()) {\n  throw new Error('--version is required, e.g. --version v1.2.3');\n}","typeGuard":"const hasVersion = (v) => v != null && String(v).trim() !== '';","tryCatchPattern":"try {\n  const tag = requireVersionTag(flagValue);\n} catch (err) {\n  if (err instanceof ArgumentError && /cannot be empty/.test(err.message)) {\n    console.error('Provide a version tag, e.g. --version v1.2.3');\n  } else throw err;\n}","preventionTips":["Use ${VAR:?} shell expansions to fail fast on unset version variables.","Make --version required in your CLI argument parser when a specific version is needed.","Omit the version filter entirely when you actually want the latest release."],"tags":["argument-error","input-validation","goproxy","semver"],"backgroundTag":"missing-required-argument","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}