{"record":{"id":"cca1b30d1f0fbe70","repo":"apache/beam","slug":"number-of-subtriggers-to-trigger-afterall-should-be-greater","errorCode":null,"errorMessage":"number of subtriggers to trigger.AfterAll() should be greater than 1, got: %v","messagePattern":"number of subtriggers to trigger\\.AfterAll\\(\\) should be greater than 1, got: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/graph/window/trigger/trigger.go","lineNumber":306,"sourceCode":"\tsubtriggers []Trigger\n}\n\n// String implements the Stringer interface and returns trigger details as a string.\nfunc (t *AfterAllTrigger) String() string {\n\treturn fmt.Sprintf(\"%#v\", t)\n}\n\nfunc (t AfterAllTrigger) trigger() {}\n\n// SubTriggers returns the component triggers.\nfunc (t *AfterAllTrigger) SubTriggers() []Trigger {\n\treturn t.subtriggers\n}\n\n// AfterAll returns a new AfterAll trigger with subtriggers set to the passed argument.\nfunc AfterAll(triggers []Trigger) *AfterAllTrigger {\n\tif len(triggers) <= 1 {\n\t\tpanic(fmt.Sprintf(\"number of subtriggers to trigger.AfterAll() should be greater than 1, got: %v\", len(triggers)))\n\t}\n\treturn &AfterAllTrigger{subtriggers: triggers}\n}\n\n// OrFinallyTrigger is ready whenever either of its subtriggers are ready, but finishes output\n// when the finally subtrigger fires.\ntype OrFinallyTrigger struct {\n\tmain    Trigger // Trigger governing main output; may fire repeatedly.\n\tfinally Trigger // Trigger governing termination of output.\n}\n\n// String implements the Stringer interface and returns trigger details as a string.\nfunc (t *OrFinallyTrigger) String() string {\n\treturn fmt.Sprintf(\"%#v\", t)\n}\n\nfunc (t OrFinallyTrigger) trigger() {}\n","sourceCodeStart":288,"sourceCodeEnd":324,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/graph/window/trigger/trigger.go#L288-L324","documentation":"trigger.AfterAll() builds an AfterAllTrigger that fires only after every subtrigger has fired. The library panics when the slice has fewer than two subtriggers, since an 'all' semantics over 0 or 1 triggers is degenerate. This is a fail-fast argument validation panic.","triggerScenarios":"Calling trigger.AfterAll(nil), AfterAll([]Trigger{}), or AfterAll with a single-element slice; note the panic message reports len(triggers).","commonSituations":"Assembling subtriggers from user configuration or a pipeline spec where the list is empty or has one entry; refactoring code that previously passed several triggers down to one.","solutions":["Pass at least two triggers to AfterAll.","Guard the call: if len(triggers) == 1 use triggers[0] directly.","If zero triggers, choose an appropriate default trigger instead of AfterAll."],"exampleFix":"// before\nt := trigger.AfterAll(subs) // panics if len(subs) <= 1\n// after\nif len(subs) == 1 {\n\tt = subs[0]\n} else {\n\tt = trigger.AfterAll(subs)\n}","handlingStrategy":"validation","validationCode":"if len(subs) < 2 {\n\treturn fmt.Errorf(\"AfterAll needs >= 2 subtriggers, got %d\", len(subs))\n}\nt := trigger.AfterAll(subs)","typeGuard":"func canAfterAll(ts []trigger.Trigger) bool { return len(ts) > 1 }","tryCatchPattern":null,"preventionTips":["Check slice length before wrapping triggers in combinators.","Handle the single-trigger case by returning the trigger itself.","Validate trigger configuration at pipeline-build time, not deep inside graph construction."],"tags":["go","panic","beam","trigger","invalid-argument"],"backgroundTag":"invalid-argument-value","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"}