fatedier/frp · error

invalid transport.protocol, optional values are %v

Error message

invalid transport.protocol, optional values are %v

What it means

transport.protocol is not in SupportedTransportProtocols. frpc supports a fixed set of control-connection transports — typically "tcp", "kcp", "quic", "websocket", "wss" (per the version's supported list, echoed in the message). Any other string fails validation.

Source

Thrown at pkg/config/v1/validation/client.go:169

			errs = AppendError(errs, fmt.Errorf("invalid transport.heartbeatTimeout, heartbeat timeout should not less than heartbeat interval"))
		}
	}

	if !lo.FromPtr(c.TLS.Enable) {
		checkTLSConfig := func(name string, value string) Warning {
			if value != "" {
				return fmt.Errorf("%s is invalid when transport.tls.enable is false", name)
			}
			return nil
		}

		warnings = AppendError(warnings, checkTLSConfig("transport.tls.certFile", c.TLS.CertFile))
		warnings = AppendError(warnings, checkTLSConfig("transport.tls.keyFile", c.TLS.KeyFile))
		warnings = AppendError(warnings, checkTLSConfig("transport.tls.trustedCaFile", c.TLS.TrustedCaFile))
	}

	if !slices.Contains(SupportedTransportProtocols, c.Protocol) {
		errs = AppendError(errs, fmt.Errorf("invalid transport.protocol, optional values are %v", SupportedTransportProtocols))
	}
	if !slices.Contains(SupportedWireProtocols, c.WireProtocol) {
		errs = AppendError(errs, fmt.Errorf("invalid transport.wireProtocol, optional values are %v", SupportedWireProtocols))
	}
	return warnings, errs
}

func validateIncludeFiles(files []string) (Warning, error) {
	var errs error
	for _, f := range files {
		absDir, err := filepath.Abs(filepath.Dir(f))
		if err != nil {
			errs = AppendError(errs, fmt.Errorf("include: parse directory of %s failed: %v", f, err))
			continue
		}
		if _, err := os.Stat(absDir); os.IsNotExist(err) {
			errs = AppendError(errs, fmt.Errorf("include: directory of %s not exist", f))
		}

View on GitHub (pinned to 6c8a8d0a97)

Solutions

  1. Set transport.protocol to one of the values printed in the error (e.g. "websocket" not "ws")
  2. Verify the frpc binary supports the protocol (quic/kcp may be absent in some distro builds)
  3. Quote the value and strip whitespace in TOML/YAML

Example fix

# before
[transport]
protocol = "ws"

# after
[transport]
protocol = "websocket"
Defensive patterns

Strategy: validation

Validate before calling

func validProtocol(p string) bool {
    return slices.Contains(validation.SupportedTransportProtocols, p)
}

Prevention

When it happens

Trigger: transport.protocol set to e.g. "udp", "http", "ws" (abbreviation), or a protocol not compiled into the frpc build; also fires on unset custom values only if explicitly set to an invalid string (default "tcp" passes).

Common situations: Using shorthand 'ws' instead of 'websocket'; expecting 'wss' availability in a build without TLS transport support; typo or trailing whitespace in YAML value.

Related errors


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