{"record":{"id":"efef2a0263f6d65d","repo":"cilium/cilium","slug":"lost-event-send-interval-must-be-greater-than-0","errorCode":null,"errorMessage":"lost event send interval must be greater than 0","messagePattern":"lost event send interval must be greater than 0","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/hubble/observer/observeroption/option.go","lineNumber":148,"sourceCode":"\treturn func(o *Options) error {\n\t\to.MonitorBuffer = size\n\t\treturn nil\n\t}\n}\n\n// WithMaxFlows that the ring buffer is initialized to hold.\nfunc WithMaxFlows(capacity container.Capacity) Option {\n\treturn func(o *Options) error {\n\t\to.MaxFlows = capacity\n\t\treturn nil\n\t}\n}\n\n// WithLostEventSendInterval sets the interval at which lost events are sent.\nfunc WithLostEventSendInterval(interval time.Duration) Option {\n\treturn func(o *Options) error {\n\t\tif interval <= 0 {\n\t\t\treturn errors.New(\"lost event send interval must be greater than 0\")\n\t\t}\n\t\to.LostEventSendInterval = interval\n\t\treturn nil\n\t}\n}\n\n// WithOnServerInit adds a new callback to be invoked after server initialization\nfunc WithOnServerInit(f OnServerInit) Option {\n\treturn func(o *Options) error {\n\t\to.OnServerInit = append(o.OnServerInit, f)\n\t\treturn nil\n\t}\n}\n\n// WithOnServerInitFunc adds a new callback to be invoked after server initialization\nfunc WithOnServerInitFunc(f func(Server) error) Option {\n\treturn WithOnServerInit(OnServerInitFunc(f))\n}","sourceCodeStart":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/cilium/cilium/blob/ac7b90affa4baf0642e6685319d56907b3a73a6d/pkg/hubble/observer/observeroption/option.go#L130-L166","documentation":"WithLostEventSendInterval is an observer option that sets how often lost-event notifications are sent; the interval must be strictly positive. A zero or negative duration is rejected by the option function so the observer is never configured with a nonsensical interval.","triggerScenarios":"Calling observeroption.WithLostEventSendInterval(0) or with a negative time.Duration (e.g. -time.Second) when building observer options.","commonSituations":"Programmatic construction of Hubble observers/standalone servers where a config value defaults to 0 because the config key was unset and no default fallback was applied.","solutions":["Pass a positive duration, e.g. WithLostEventSendInterval(1 * time.Second).","If the value comes from config, validate/default it before applying options.","Omit the option entirely to use the default LostEventSendInterval."],"exampleFix":"// before\nWithLostEventSendInterval(cfg.LostEventInterval) // 0 when unset\n// after\nif cfg.LostEventInterval > 0 { opts = append(opts, WithLostEventSendInterval(cfg.LostEventInterval)) }","handlingStrategy":"validation","validationCode":"if interval <= 0 {\n    return fmt.Errorf(\"lost event send interval must be positive, got %v\", interval)\n}\nopts = append(opts, WithLostEventSendInterval(interval))","typeGuard":null,"tryCatchPattern":"if err := opt(o); err != nil {\n    var d time.Duration\n    _ = d\n    return fmt.Errorf(\"observer option failed: %w\", err)\n}","preventionTips":["Default unset durations to a sane positive value before building options.","Wrap option application and log which option failed.","Never pass raw config durations without bounds-checking."],"tags":["hubble","observer","configuration","validation"],"backgroundTag":"invalid-parameter-value","analyzedSha":"ac7b90affa4baf0642e6685319d56907b3a73a6d","analyzedAt":"2026-08-31T18:27:15.868Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}