{"record":{"id":"5cc939db5c932fab","repo":"probelabs/goreplay","slug":"unsupported-protocol-s","errorCode":null,"errorMessage":"unsupported protocol %s","messagePattern":"unsupported protocol (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/tcp/tcp_message.go","lineNumber":33,"sourceCode":"// TCPProtocol is a number to indicate type of protocol\ntype TCPProtocol uint8\n\nconst (\n\t// ProtocolHTTP ...\n\tProtocolHTTP TCPProtocol = iota\n\t// ProtocolBinary ...\n\tProtocolBinary\n)\n\n// Set is here so that TCPProtocol can implement flag.Var\nfunc (protocol *TCPProtocol) Set(v string) error {\n\tswitch v {\n\tcase \"\", \"http\":\n\t\t*protocol = ProtocolHTTP\n\tcase \"binary\":\n\t\t*protocol = ProtocolBinary\n\tdefault:\n\t\treturn fmt.Errorf(\"unsupported protocol %s\", v)\n\t}\n\treturn nil\n}\n\nfunc (protocol *TCPProtocol) String() string {\n\tswitch *protocol {\n\tcase ProtocolBinary:\n\t\treturn \"binary\"\n\tcase ProtocolHTTP:\n\t\treturn \"http\"\n\tdefault:\n\t\treturn \"\"\n\t}\n}\n\n// Stats every message carry its own stats object\ntype Stats struct {\n\tLostData  int","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/probelabs/goreplay/blob/251e45abd242886bb64ff2b2dc98789556b56330/internal/tcp/tcp_message.go#L15-L51","documentation":"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.","triggerScenarios":"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'.","commonSituations":"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.","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."],"exampleFix":"// before\nprotocol.Set(\"https\")\n// after\nprotocol.Set(\"http\") // or \"binary\"; TLS is configured separately","handlingStrategy":"validation","validationCode":"var validProtocols = map[string]bool{\"\": true, \"http\": true, \"binary\": true}\nfunc validProtocol(v string) bool { return validProtocols[strings.ToLower(strings.TrimSpace(v))] }","typeGuard":null,"tryCatchPattern":"var p tcp.Protocol\nif err := p.Set(cfgValue); err != nil {\n\treturn fmt.Errorf(\"tcp protocol must be http or binary, got %q\", cfgValue)\n}","preventionTips":["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)"],"tags":["validation","configuration","protocol","go"],"backgroundTag":"unsupported-protocol-value","analyzedSha":"251e45abd242886bb64ff2b2dc98789556b56330","analyzedAt":"2026-09-02T16:44:11.369Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T21:17:11.164Z"}