{"record":{"id":"02b8ae6009717c03","repo":"golangci/golangci-lint","slug":"invalid-go-runtime-version-s","errorCode":null,"errorMessage":"invalid Go runtime version: %s","messagePattern":"invalid Go runtime version: (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/goutil/version.go","lineNumber":72,"sourceCode":"\n\treturn v\n}\n\nfunc CleanRuntimeVersion() (string, error) {\n\treturn cleanRuntimeVersion(runtime.Version())\n}\n\nfunc cleanRuntimeVersion(rv string) (string, error) {\n\tfor part := range strings.FieldsSeq(rv) {\n\t\t// Allow to handle:\n\t\t// - GOEXPERIMENT -> \"go1.23.0 X:boringcrypto\"\n\t\t// - devel -> \"devel go1.24-e705a2d Wed Aug 7 01:16:42 2024 +0000 linux/amd64\"\n\t\tif strings.HasPrefix(part, \"go1.\") {\n\t\t\treturn part, nil\n\t\t}\n\t}\n\n\treturn \"\", fmt.Errorf(\"invalid Go runtime version: %s\", rv)\n}\n","sourceCodeStart":54,"sourceCodeEnd":74,"githubUrl":"https://github.com/golangci/golangci-lint/blob/ed7a235d2d771152056fdc142a9855567c5796a9/pkg/goutil/version.go#L54-L74","documentation":"cleanRuntimeVersion parses the output of `go version` looking for a token starting with \"go1.\" (e.g. \"go1.22.1\" or a devel build like \"go1.24-e705a2d\"). If no such token is found in any part of the version string, it gives up with this error. The library throws it because it cannot map the installed Go toolchain to a parseable version.","triggerScenarios":"Calling CleanRuntimeVersion (or the anonymous helper via ParseGoVersion) with a raw version string that contains no \"go1.\" token, e.g. empty output, `go version` from a non-Go toolchain, or a hand-crafted string like \"devel +abc123\" without the go1 prefix.","commonSituations":"Custom or misinstalled Go toolchains (gotip builds whose output changed format), third-party compilers (gccgo reporting \"gccgo (GCC) 12.0\"), corrupted PATH where `go` resolves to a wrapper script, or CI images where the go binary is a shim emitting unexpected text.","solutions":["Run `go version` manually and confirm the output contains a token like \"go1.22\"; fix the PATH or reinstall Go if not.","If using a devel/gotip toolchain, switch to a stable release (golang.org/dl/go1.22.x) whose version string is supported.","For gccgo or alternative toolchains, install the official gc-based Go toolchain.","If passing a version string programmatically to CleanRuntimeVersion, normalize it first so it includes the \"go1.\" token."],"exampleFix":"// before (nonstandard toolchain output)\ngo version\n# gccgo (GCC) 12.0\n\n// after (official toolchain)\n$ PATH=/usr/local/go/bin:$PATH go version\n# go version go1.22.5 linux/amd64","handlingStrategy":"validation","validationCode":"rv, err := exec.Command(\"go\", \"version\").Output()\nif err != nil { return err }\nif !strings.Contains(string(rv), \"go1.\") {\n    return fmt.Errorf(\"unsupported go version output: %q\", rv)\n}\n// safe to proceed with CleanRuntimeVersion","typeGuard":"func isParseableGoVersion(rv string) bool {\n    for _, part := range strings.Fields(rv) {\n        if strings.HasPrefix(part, \"go1.\") { return true }\n    }\n    return false\n}","tryCatchPattern":"v, err := goutil.CleanRuntimeVersion(raw)\nif err != nil {\n    var verr = err // inspect strings.Contains(err.Error(), \"invalid Go runtime version\")\n    log.Warnf(\"go version unparsable, skipping version checks: %v\", verr)\n    return nil\n}","preventionTips":["Always install and pin the official Go toolchain in CI images.","Sanity-check `go version` output in setup scripts before running tools that parse it.","Avoid gccgo/gotip shims in environments that run static analysis."],"tags":["go","toolchain","version-parsing"],"backgroundTag":"unsupported-go-version-format","analyzedSha":"ed7a235d2d771152056fdc142a9855567c5796a9","analyzedAt":"2026-09-02T18:47:33.865Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}