fatedier/frp · error

invalid log level, optional values are %v

Error message

invalid log level, optional values are %v

What it means

log.level is not one of SupportedLogLevels (typically trace, debug, info, warn, error). validateLogConfig checks membership with slices.Contains and returns the allowed values in the message, failing before the logger is constructed.

Source

Thrown at pkg/config/v1/validation/common.go:47

		if c.TLS.KeyFile == "" {
			return fmt.Errorf("tls.keyFile must be specified when tls is enabled")
		}
	}

	return ValidatePort(c.Port, "webServer.port")
}

// ValidatePort checks that the network port is in range
func ValidatePort(port int, fieldPath string) error {
	if 0 <= port && port <= 65535 {
		return nil
	}
	return fmt.Errorf("%s: port number %d must be in the range 0..65535", fieldPath, port)
}

func validateLogConfig(c *v1.LogConfig) error {
	if !slices.Contains(SupportedLogLevels, c.Level) {
		return fmt.Errorf("invalid log level, optional values are %v", SupportedLogLevels)
	}
	return nil
}

View on GitHub (pinned to 6c8a8d0a97)

Solutions

  1. Use a value from the message's list, lowercase — commonly "debug", "info", "warn", "error", "trace"
  2. Change "warning" to "warn"
  3. Remove log.level to accept the default (info)

Example fix

# before
[log]
level = "warning"

# after
[log]
level = "warn"
Defensive patterns

Strategy: validation

Validate before calling

func validLogLevel(l string) bool {
    return slices.Contains(validation.SupportedLogLevels, l)
}

Prevention

When it happens

Trigger: log.level = "warning" (the long form used by many other systems) instead of "warn"; "fatal"/"panic" (zap levels not exposed); casing like "DEBUG".

Common situations: Porting log settings from log4j/python conventions; uppercasing levels in Helm charts; typo.

Related errors


AI-assisted analysis of fatedier/frp@6c8a8d0a97 (2026-08-15). Data as JSON: /api/errors/bf27a9d933f61503. Report an issue: GitHub.