{"record":{"id":"bc584bc8580efa79","repo":"golang/go","slug":"removed-godebug-q-set-to-old-value-q-https-go","errorCode":null,"errorMessage":"removed GODEBUG %q set to old value %q (https://go.dev/doc/godebug#go-1%v)","messagePattern":"removed GODEBUG %q set to old value %q \\(https://go\\.dev/doc/godebug#go-1(.+?)\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmd/go/internal/modload/init.go","lineNumber":2310,"sourceCode":"\tif strings.ContainsAny(v, \",\") {\n\t\treturn fmt.Errorf(\"value contains comma\")\n\t}\n\tif k == \"default\" {\n\t\tif !strings.HasPrefix(v, \"go\") || !gover.IsValid(v[len(\"go\"):]) {\n\t\t\treturn fmt.Errorf(\"value for default= must be goVERSION\")\n\t\t}\n\t\tif gover.Compare(v[len(\"go\"):], gover.Local()) > 0 {\n\t\t\treturn fmt.Errorf(\"default=%s too new (toolchain is go%s)\", v, gover.Local())\n\t\t}\n\t\treturn nil\n\t}\n\tif godebugs.Lookup(k) != nil {\n\t\treturn nil\n\t}\n\tfor _, info := range godebugs.Removed {\n\t\tif info.Name == k {\n\t\t\tif info.Old(v) {\n\t\t\t\treturn fmt.Errorf(\"removed GODEBUG %q set to old value %q (https://go.dev/doc/godebug#go-1%v)\", k, v, info.Removed)\n\t\t\t}\n\t\t\t// Using a removed GODEBUG setting with a non-old value is ok (see go.dev/issue/76163).\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn fmt.Errorf(\"unknown %s %q\", verb, k)\n}\n","sourceCodeStart":2292,"sourceCodeEnd":2318,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/cmd/go/internal/modload/init.go#L2292-L2318","documentation":"Thrown by CheckGodebug when a GODEBUG key has been removed from Go (listed in godebugs.Removed) AND the value provided is the 'old' value that would re-enable the removed behavior. The check iterates godebugs.Removed, matches the key, and calls info.Old(v). If Old(v) is true, the error is returned with a link to the Go version that removed it. Using a removed setting with a non-old value is explicitly allowed (see go.dev/issue/76163).","triggerScenarios":"A go.mod or go.work contains a godebug directive for a setting that was removed in a recent Go release, with the value that restores the pre-removal default. For example, after a setting like 'http2goaway' is removed, setting it to its old value triggers this. The error message includes the Go version (info.Removed) where removal happened.","commonSituations":"Upgrading the Go toolchain to a version that removed a GODEBUG setting, while the project's go.mod still references the old setting with its old value. Carrying forward legacy GODEBUG directives across major Go upgrades without cleanup.","solutions":["Remove the offending 'godebug' line from go.mod/go.work — the setting no longer exists and the old behavior is gone.","If you need the old value for a transitional period, update the value to the non-old (new default) form, which is permitted.","Consult the linked documentation at https://go.dev/doc/godebug for the specific removed setting and its replacement."],"exampleFix":"// before (setting removed in go1.N)\ngodebug removedsetting=0\n\n// after — delete the line:\n// (removed)","handlingStrategy":"validation","validationCode":"// Check if a godebug key is removed and the value is its old value.\n// (Requires access to internal/runtime/godebugs.Removed list.)\nfunc checkRemovedGodebug(k, v string) error {\n    for _, info := range godebugs.Removed {\n        if info.Name == k && info.Old(v) {\n            return fmt.Errorf(\"removed GODEBUG %q set to old value %q\", k, v)\n        }\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["After upgrading Go, review and prune godebug directives that reference removed settings.","Consult https://go.dev/doc/godebug for the list of active and removed settings per Go version.","Set removed GODEBUG keys to their non-old (new default) value if transitional behavior is needed, or remove the line entirely."],"tags":["godebug","go-mod","go-work","deprecation","upgrade"],"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-12T08:17:17.861Z"}