wtfutil/wtf · error

%s module: Unsupported protocol version: '%s'

Error message

%s module: Unsupported protocol version: '%s'

What it means

newProtocolVersion validates the `protocolVersion` YAML setting of the ipinfo widget and rejects any value other than 'v4', 'v6', or 'auto'. The error names the module (defaultTitle) and echoes the offending string so the bad config value is immediately visible.

Source

Thrown at modules/ipaddresses/ipinfo/settings.go:40

	case ipV4:
		return "v4"
	case ipV6:
		return "v6"
	default:
		return "auto"
	}
}

func newProtocolVersion(str string) (protocolVersion, error) {
	switch str {
	case "v4":
		return ipV4, nil
	case "v6":
		return ipV6, nil
	case "auto":
		return auto, nil
	default:
		return "", fmt.Errorf("%s module: Unsupported protocol version: '%s'", defaultTitle, str)
	}
}

type Settings struct {
	*cfg.Common

	apiToken        string          `help:"An api token" optional:"true"`
	protocolVersion protocolVersion `help:"IP protocol version to display. Possible options are: 'v4' to show only IpV4 address, 'v6' to show only IpV6 address and 'auto' (default) to show the address preferred by OS." optional:"true"`
}

func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
	settings := Settings{
		Common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),

		apiToken:        ymlConfig.UString("apiToken", ""),
		protocolVersion: auto,
	}

View on GitHub (pinned to bb838c1ccb)

Solutions

  1. Set protocolVersion to exactly one of: v4, v6, or auto
  2. Remove the protocolVersion key to fall back to the default
  3. Check the ipinfo widget docs for accepted values

Example fix

# before
protocolVersion: ipv4
# after
protocolVersion: v4
Defensive patterns

Strategy: validation

Validate before calling

pv := settings.ProtocolVersion
if pv != "" && pv != "v4" && pv != "v6" && pv != "auto" {
    return fmt.Errorf("ipinfo: invalid protocolVersion %q (want v4|v6|auto)", pv)
}

Type guard

func isValidProtocolVersion(s string) bool {
    switch s {
    case "", "v4", "v6", "auto":
        return true
    }
    return false
}

Prevention

When it happens

Trigger: NewSettingsFromYAML encounters a settings.protocolVersion value like 'ipv4', 'IPv6', '4', '6', 'both', or an empty/typo'd string instead of exactly v4|v6|auto.

Common situations: Typos in the widget YAML (e.g. 'IPV4', 'v 4'), assuming other aliases are accepted, copying config from an older/newer version where the option changed.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of wtfutil/wtf@bb838c1ccb (2026-09-03). Data as JSON: /api/errors/fa391b9b119b6fc0. Report an issue: GitHub.