{"record":{"id":"ac28c739ada4e1be","repo":"apache/beam","slug":"trigger-argument-to-trigger-repeat-cannot-be-nil","errorCode":null,"errorMessage":"trigger argument to trigger.Repeat() cannot be nil","messagePattern":"trigger argument to trigger\\.Repeat\\(\\) cannot be nil","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/graph/window/trigger/trigger.go","lineNumber":208,"sourceCode":"// String implements the Stringer interface and returns trigger details as a string.\nfunc (t *RepeatTrigger) String() string {\n\treturn fmt.Sprintf(\"%#v\", t)\n}\n\nfunc (t RepeatTrigger) trigger() {}\n\n// SubTrigger returns the trigger to be repeated.\nfunc (t *RepeatTrigger) SubTrigger() Trigger {\n\treturn t.subtrigger\n}\n\n// Repeat constructs a trigger that fires a trigger repeatedly\n// once the condition has been met.\n//\n// Ex: trigger.Repeat(trigger.AfterCount(1)) is same as trigger.Always().\nfunc Repeat(t Trigger) *RepeatTrigger {\n\tif t == nil {\n\t\tpanic(\"trigger argument to trigger.Repeat() cannot be nil\")\n\t}\n\treturn &RepeatTrigger{subtrigger: t}\n}\n\n// AfterEndOfWindowTrigger provides option to set triggers for early and late firing.\ntype AfterEndOfWindowTrigger struct {\n\tearlyFiring Trigger\n\tlateFiring  Trigger\n}\n\n// String implements the Stringer interface and returns trigger details as a string.\nfunc (t *AfterEndOfWindowTrigger) String() string {\n\treturn fmt.Sprintf(\"%#v\", t)\n}\n\nfunc (t AfterEndOfWindowTrigger) trigger() {}\n\n// Early returns the Early Firing trigger for AfterEndOfWindowTrigger.","sourceCodeStart":190,"sourceCodeEnd":226,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/graph/window/trigger/trigger.go#L190-L226","documentation":"trigger.Repeat panics when its Trigger argument is nil. Repeat wraps a sub-trigger that fires repeatedly; a nil sub-trigger is meaningless and would fail later during trigger evaluation, so the SDK fails fast at construction.","triggerScenarios":"Calling trigger.Repeat(nil) directly, or passing a trigger variable that was never initialized (e.g. a lookup that missed, or a conditional that skipped assignment).","commonSituations":"Building triggers from configuration where the configured sub-trigger name didn't resolve; helper functions returning nil Trigger on unknown kinds that is then wrapped in Repeat.","solutions":["Pass a concrete trigger such as trigger.AfterCount(1) or trigger.AfterFirst() to Repeat","Fix the construction path that returned nil (unmatched config value, unhandled trigger kind)","Note trigger.Repeat(trigger.AfterCount(1)) is equivalent to trigger.Always() — use that directly if applicable"],"exampleFix":"// before\nvar t trigger.Trigger // nil\ntw := trigger.Repeat(t)\n// after\ntw := trigger.Repeat(trigger.AfterCount(1))","handlingStrategy":"validation","validationCode":"if t == nil {\n\treturn errors.New(\"sub-trigger is nil; supply e.g. trigger.AfterCount(1)\")\n}","typeGuard":"func validTrigger(t trigger.Trigger) bool { return t != nil }","tryCatchPattern":"func safeRepeat(t trigger.Trigger) (tr *trigger.RepeatTrigger, err error) {\n\tdefer func() { if r := recover(); r != nil { err = fmt.Errorf(\"trigger.Repeat: %v\", r) } }()\n\treturn trigger.Repeat(t), nil\n}","preventionTips":["Never wrap a zero-value Trigger variable; construct one explicitly","Resolve configured trigger names to concrete triggers with a default fallback","Remember trigger.Repeat(trigger.AfterCount(1)) == trigger.Always() for the common case"],"tags":["go","beam","trigger","nil-pointer"],"backgroundTag":"null-argument","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}