golang/go · error

removed GODEBUG %q set to old value %q (https://go.dev/doc/g

Error message

removed GODEBUG %q set to old value %q (https://go.dev/doc/godebug#go-1%v)

What it means

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).

Source

Thrown at src/cmd/go/internal/modload/init.go:2310

	if strings.ContainsAny(v, ",") {
		return fmt.Errorf("value contains comma")
	}
	if k == "default" {
		if !strings.HasPrefix(v, "go") || !gover.IsValid(v[len("go"):]) {
			return fmt.Errorf("value for default= must be goVERSION")
		}
		if gover.Compare(v[len("go"):], gover.Local()) > 0 {
			return fmt.Errorf("default=%s too new (toolchain is go%s)", v, gover.Local())
		}
		return nil
	}
	if godebugs.Lookup(k) != nil {
		return nil
	}
	for _, info := range godebugs.Removed {
		if info.Name == k {
			if info.Old(v) {
				return fmt.Errorf("removed GODEBUG %q set to old value %q (https://go.dev/doc/godebug#go-1%v)", k, v, info.Removed)
			}
			// Using a removed GODEBUG setting with a non-old value is ok (see go.dev/issue/76163).
			return nil
		}
	}
	return fmt.Errorf("unknown %s %q", verb, k)
}

View on GitHub (pinned to b6b368adc5)

Solutions

  1. Remove the offending 'godebug' line from go.mod/go.work — the setting no longer exists and the old behavior is gone.
  2. If you need the old value for a transitional period, update the value to the non-old (new default) form, which is permitted.
  3. Consult the linked documentation at https://go.dev/doc/godebug for the specific removed setting and its replacement.

Example fix

// before (setting removed in go1.N)
godebug removedsetting=0

// after — delete the line:
// (removed)
Defensive patterns

Strategy: validation

Validate before calling

// Check if a godebug key is removed and the value is its old value.
// (Requires access to internal/runtime/godebugs.Removed list.)
func checkRemovedGodebug(k, v string) error {
    for _, info := range godebugs.Removed {
        if info.Name == k && info.Old(v) {
            return fmt.Errorf("removed GODEBUG %q set to old value %q", k, v)
        }
    }
    return nil
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of golang/go@b6b368adc5 (2026-08-12). Data as JSON: /api/errors/bc584bc8580efa79. Report an issue: GitHub.