probelabs/goreplay · error
invalid engine %s
Error message
invalid engine %s
What it means
EngineType.Set parses a user-supplied engine string into the internal EngineType enum. Recognized values are pcap, raw_socket, af_packet and vxlan; any other value returns "invalid engine <value>". It is a config-parsing validation error, thrown before any capture begins.
Source
Thrown at internal/capture/capture.go:125
EngineAFPacket
EngineVXLAN
)
// Set is here so that EngineType can implement flag.Var
func (eng *EngineType) Set(v string) error {
switch v {
case "", "libpcap":
*eng = EnginePcap
case "pcap_file":
*eng = EnginePcapFile
case "raw_socket":
*eng = EngineRawSocket
case "af_packet":
*eng = EngineAFPacket
case "vxlan":
*eng = EngineVXLAN
default:
return fmt.Errorf("invalid engine %s", v)
}
return nil
}
func (eng *EngineType) String() (e string) {
switch *eng {
case EnginePcapFile:
e = "pcap_file"
case EnginePcap:
e = "libpcap"
case EngineRawSocket:
e = "raw_socket"
case EngineAFPacket:
e = "af_packet"
case EngineVXLAN:
e = "vxlan"
default:
e = ""View on GitHub (pinned to 251e45abd2)
Solutions
- Use exactly one of: pcap, raw_socket, af_packet, vxlan
- Lowercase and trim the value before assigning (engine parsing is case-sensitive)
- Log/print the invalid value to spot the typo (it is embedded in the error message)
- Normalize old config names in a migration map if upgrading between versions
Example fix
// before
cfg.Engine.Set("afpacket") // error: invalid engine afpacket
// after
cfg.Engine.Set("af_packet") Defensive patterns
Strategy: validation
Validate before calling
var validEngines = map[string]bool{"pcap": true, "raw_socket": true, "af_packet": true, "vxlan": true}
func validEngine(v string) bool { return validEngines[strings.ToLower(strings.TrimSpace(v))] } Try / catch
if err := cfg.Engine.Set(v); err != nil {
return fmt.Errorf("engine %q: %w (valid: pcap, raw_socket, af_packet, vxlan)", v, err)
} Prevention
- Use only the exact strings: pcap, raw_socket, af_packet, vxlan
- Normalize config values with strings.ToLower before parsing
- Validate engine names at config-load time, not at capture time
When it happens
Trigger: Setting the listener config's engine (e.g. config.Engine.Set("<value>") or a config file field) to any string other than "pcap", "raw_socket", "af_packet", or "vxlan".
Common situations: Typo in config file (e.g. "afpacket" without underscore, "rawsocket"); upper/lowercase mismatch ("PCAP"); renaming engines across versions; copy-pasting engine names from other tools.
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
- invalid _len %q
- unsupported protocol %s
- Not supported k8s scheme. Allowed values: [namespace/]pod/[p
- inactive handle error: %q, interface: %q
- %q: supported timestamps: %q, interface: %q
AI-assisted analysis of probelabs/goreplay@251e45abd2 (2026-09-02).
Data as JSON: /api/errors/3f54c0b3484867b5.
Report an issue: GitHub.