{"record":{"id":"79bd00312420d945","repo":"bettercap/bettercap","slug":"events-waitfor-s-d-timed-out","errorCode":null,"errorMessage":"'events.waitFor %s %d' timed out.","messagePattern":"'events\\.waitFor (.+?) (.+?)' timed out\\.","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"modules/events_stream/events_stream.go","lineNumber":352,"sourceCode":"}\n\nfunc (mod *EventsStream) startWaitingFor(tag string, timeout int) error {\n\tif timeout == 0 {\n\t\tmod.Info(\"waiting for event %s ...\", tui.Green(tag))\n\t} else {\n\t\tmod.Info(\"waiting for event %s for %d seconds ...\", tui.Green(tag), timeout)\n\t\tgo func() {\n\t\t\ttime.Sleep(time.Duration(timeout) * time.Second)\n\t\t\tmod.waitFor = \"\"\n\t\t\tmod.waitChan <- nil\n\t\t}()\n\t}\n\n\tmod.waitFor = tag\n\tevent := <-mod.waitChan\n\n\tif event == nil {\n\t\treturn fmt.Errorf(\"'events.waitFor %s %d' timed out.\", tag, timeout)\n\t} else {\n\t\tmod.Debug(\"got event: %v\", event)\n\t}\n\n\treturn nil\n}\n\nfunc (mod *EventsStream) Stop() error {\n\treturn mod.SetRunning(false, func() {\n\t\tmod.quit <- true\n\t\tif mod.output != os.Stdout {\n\t\t\tif fp, ok := mod.output.(*os.File); ok {\n\t\t\t\tfp.Close()\n\t\t\t}\n\t\t}\n\t})\n}\n","sourceCodeStart":334,"sourceCodeEnd":370,"githubUrl":"https://github.com/bettercap/bettercap/blob/8eca2820f3c41d2004434ed5a291d87462caeeb7/modules/events_stream/events_stream.go#L334-L370","documentation":"Timeout result in events_stream's startWaitingFor: the module registered a waitFor on a tag and no matching event arrived on waitChan before the configured timeout elapsed (the timer goroutine pushes nil). The error reports the tag and the timeout in seconds and is surfaced to the user of events.waitFor.","triggerScenarios":"Thrown at modules/events_stream/events_stream.go:352 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Increase the timeout argument of events.waitFor","Verify the event tag matches exactly what the emitting module publishes (use events.show/events.view to inspect)","Confirm the action that should trigger the event is actually running (e.g. the attack or recon still active)","Poll for the event in a retry loop on the caller side if waiting is best-effort"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8eca2820f3c41d2004434ed5a291d87462caeeb7","analyzedAt":"2026-09-02T12:49:00.712Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T16:17:10.729Z"}