probelabs/goreplay · error
unsupported protocol %s
Error message
unsupported protocol %s
What it means
TCPProtocol.Set converts a string protocol value into the typed TCPProtocol enum; only '' (empty), 'http', and 'binary' are supported. Any other value returns 'unsupported protocol %s', indicating an invalid protocol configuration for the TCP input/output.
Source
Thrown at internal/tcp/tcp_message.go:33
// TCPProtocol is a number to indicate type of protocol
type TCPProtocol uint8
const (
// ProtocolHTTP ...
ProtocolHTTP TCPProtocol = iota
// ProtocolBinary ...
ProtocolBinary
)
// Set is here so that TCPProtocol can implement flag.Var
func (protocol *TCPProtocol) Set(v string) error {
switch v {
case "", "http":
*protocol = ProtocolHTTP
case "binary":
*protocol = ProtocolBinary
default:
return fmt.Errorf("unsupported protocol %s", v)
}
return nil
}
func (protocol *TCPProtocol) String() string {
switch *protocol {
case ProtocolBinary:
return "binary"
case ProtocolHTTP:
return "http"
default:
return ""
}
}
// Stats every message carry its own stats object
type Stats struct {
LostData intView on GitHub (pinned to 251e45abd2)
Solutions
- Set protocol to one of: '', 'http', 'binary' (lowercase).
- If TLS is needed, keep protocol as http/binary and configure TLS separately, not via the protocol field.
- Check the config key casing and spelling; the match is exact.
- If a new protocol is required, add a case to TCPProtocol.Set and a corresponding String() branch.
Example fix
// before
protocol.Set("https")
// after
protocol.Set("http") // or "binary"; TLS is configured separately Defensive patterns
Strategy: validation
Validate before calling
var validProtocols = map[string]bool{"": true, "http": true, "binary": true}
func validProtocol(v string) bool { return validProtocols[strings.ToLower(strings.TrimSpace(v))] } Try / catch
var p tcp.Protocol
if err := p.Set(cfgValue); err != nil {
return fmt.Errorf("tcp protocol must be http or binary, got %q", cfgValue)
} Prevention
- Whitelist protocol values at config-load time
- Keep values lowercase and trimmed
- Note that TLS is configured separately from protocol
- Add enum validation to config schema (e.g. JSON schema enum)
When it happens
Trigger: Setting a TCP connection's protocol via Set with a string other than 'http' or 'binary' (or empty) — e.g. from a config value like 'https', 'raw', 'tcp', 'grpc'.
Common situations: YAML/JSON config for a TCP module with protocol: https (author assuming TLS implies a protocol type); typos like 'binay'; copying config from another product that supports more protocol names.
Related errors
- invalid engine %s
- invalid _len %q
- err.Error()
- Not supported k8s scheme. Allowed values: [namespace/]pod/[p
- inactive handle error: %q, interface: %q
AI-assisted analysis of probelabs/goreplay@251e45abd2 (2026-09-02).
Data as JSON: /api/errors/5cc939db5c932fab.
Report an issue: GitHub.