{"record":{"id":"82a6a69806358b82","repo":"probelabs/goreplay","slug":"q-supported-timestamps-q-interface-q","errorCode":null,"errorMessage":"%q: supported timestamps: %q, interface: %q","messagePattern":"%q: supported timestamps: %q, interface: %q","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"internal/capture/capture.go","lineNumber":417,"sourceCode":"}\n\n// PcapHandle returns new pcap Handle from dev on success.\n// this function should be called after setting all necessary options for this listener\nfunc (l *Listener) PcapHandle(ifi pcap.Interface) (handle *pcap.Handle, err error) {\n\tvar inactive *pcap.InactiveHandle\n\tinactive, err = pcap.NewInactiveHandle(ifi.Name)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"inactive handle error: %q, interface: %q\", err, ifi.Name)\n\t}\n\tdefer inactive.CleanUp()\n\n\tif l.config.TimestampType != \"\" && l.config.TimestampType != \"go\" {\n\t\tvar ts pcap.TimestampSource\n\t\tts, err = pcap.TimestampSourceFromString(l.config.TimestampType)\n\t\tfmt.Println(\"Setting custom Timestamp Source. Supported values: `go`, \", inactive.SupportedTimestamps())\n\t\terr = inactive.SetTimestampSource(ts)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"%q: supported timestamps: %q, interface: %q\", err, inactive.SupportedTimestamps(), ifi.Name)\n\t\t}\n\t}\n\tif l.config.Promiscuous {\n\t\tif err = inactive.SetPromisc(l.config.Promiscuous); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"promiscuous mode error: %q, interface: %q\", err, ifi.Name)\n\t\t}\n\t}\n\tif l.config.Monitor {\n\t\tif err = inactive.SetRFMon(l.config.Monitor); err != nil && !errors.Is(err, pcap.CannotSetRFMon) {\n\t\t\treturn nil, fmt.Errorf(\"monitor mode error: %q, interface: %q\", err, ifi.Name)\n\t\t}\n\t}\n\n\tvar snap int\n\n\tif !l.config.Snaplen {\n\t\tinfs, _ := net.Interfaces()\n\t\tfor _, i := range infs {","sourceCodeStart":399,"sourceCodeEnd":435,"githubUrl":"https://github.com/probelabs/goreplay/blob/251e45abd242886bb64ff2b2dc98789556b56330/internal/capture/capture.go#L399-L435","documentation":"When config.TimestampType is set to a value other than empty or \"go\", PcapHandle resolves it with pcap.TimestampSourceFromString and calls inactive.SetTimestampSource. On failure the error is wrapped with the list of timestamps the interface actually supports: \"<err>: supported timestamps: <list>, interface: <name>\". It means the requested timestamp source is not available for that interface/libpcap build.","triggerScenarios":"Configuring l.config.TimestampType to a source (e.g. \"adapter_unsynced\", \"host_precise\", \"host_hpcut\") that pcap.TimestampSourceFromString accepts but SetTimestampSource rejects for the given interface, because the libpcap build or NIC driver does not support it.","commonSituations":"Copying a TimestampType from another machine or NIC vendor documentation; libpcap compiled without hardware timestamp support; different kernel/driver (e.g. NIC without PHC); typos like \"host-precise\" vs \"host\".","solutions":["Read the supported list embedded in the error (inactive.SupportedTimestamps()) and pick one of those values","Remove TimestampType or set it to \"go\" to use the default Go-side timestamping","Upgrade libpcap/kernel/driver if hardware timestamping is required","Validate the requested timestamp source against pcap.TimestampSourceFromString output before applying it"],"exampleFix":"// before\ncfg.TimestampType = \"adapter\" // unsupported on this NIC\n// after\ncfg.TimestampType = \"\" // use default\n// or check:\nts, err := pcap.TimestampSourceFromString(cfg.TimestampType)\n_ = ts\n","handlingStrategy":"validation","validationCode":"if cfg.TimestampType != \"\" && cfg.TimestampType != \"go\" {\n    inact, _ := pcap.NewInactiveHandle(cfg.Iface)\n    defer inact.CleanUp()\n    ok := false\n    for _, ts := range inact.SupportedTimestamps() { if ts.String() == cfg.TimestampType { ok = true } }\n    if !ok { return fmt.Errorf(\"timestamp %q unsupported; supported: %v\", cfg.TimestampType, inact.SupportedTimestamps()) }\n}","typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"supported timestamps\") {\n    log.Warnf(\"timestamp source unsupported, falling back to default: %v\", err)\n    cfg.TimestampType = \"\"\n    handle, err = l.PcapHandle(ifi)\n}","preventionTips":["Pick timestamp sources only from inactive.SupportedTimestamps() on the target host","Leave TimestampType empty or \"go\" unless hardware timestamping is verified","Don't copy timestamp settings across machines/NICs"],"tags":["go","pcap","timestamps","libpcap"],"backgroundTag":"unsupported-timestamp-source","analyzedSha":"251e45abd242886bb64ff2b2dc98789556b56330","analyzedAt":"2026-09-02T16:44:11.369Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T21:17:11.164Z"}