apache/beam · error

At least one subtrigger required for composite triggers.

Error message

At least one subtrigger required for composite triggers.

What it means

extractSubtriggers converts a composite trigger's sub-triggers into their protobuf representation when translating a Beam pipeline graph to the runner API. Composite triggers (Always/AfterAll/AfterAny/AfterEach/AfterFirst) must contain at least one sub-trigger; the library panics rather than producing an invalid pipeline proto if the list is empty.

Solutions

  1. Pass at least one sub-trigger to the composite trigger, e.g. trigger.AfterAll(trigger.AfterCount(1), trigger.AfterProcessingTime().PlusDelay(...)).
  2. If the sub-trigger list is dynamic, guard with len check before building the windowing strategy and fall back to a default trigger.
  3. Use trigger.DefaultTrigger() or trigger.Never() when you truly want no custom sub-triggers.

Example fix

// before
w := window.NewTrigger(window.AfterAll(subs...)) // subs is empty
// after
if len(subs) == 0 {
    subs = append(subs, window.DefaultTrigger())
}
w := window.NewTrigger(window.AfterAll(subs...))
Defensive patterns

Strategy: validation

Validate before calling

if len(subTriggers) == 0 {
    subTriggers = []trigger.Trigger{trigger.DefaultTrigger()}
}

Prevention

When it happens

Trigger: Calling trigger.Always(), AfterAll, AfterAny, AfterEach or AfterFirst with zero sub-triggers (e.g. trigger.AfterAll() with no arguments) while building a pipeline windowing strategy, which then hits extractSubtriggers during graph translation.

Common situations: Constructing windowing strategies programmatically from a dynamic/empty list of trigger conditions; a config-driven trigger builder that yields an empty slice; refactoring that accidentally removes the single sub-trigger.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/5f81e0abf726b8cf. Report an issue: GitHub.

Appendix: source

Thrown at sdks/go/pkg/beam/core/runtime/graphx/translate.go:1420

		return &pipepb.Trigger{
			Trigger: &pipepb.Trigger_AfterEach_{
				AfterEach: &pipepb.Trigger_AfterEach{
					Subtriggers: extractSubtriggers(t.Subtriggers()),
				},
			},
		}
	default:
		return &pipepb.Trigger{
			Trigger: &pipepb.Trigger_Default_{
				Default: &pipepb.Trigger_Default{},
			},
		}
	}
}

func extractSubtriggers(t []trigger.Trigger) []*pipepb.Trigger {
	if len(t) <= 0 {
		panic("At least one subtrigger required for composite triggers.")
	}

	var result []*pipepb.Trigger
	for _, tr := range t {
		result = append(result, makeTrigger(tr))
	}
	return result
}

func makeWindowFn(w *window.Fn) (*pipepb.FunctionSpec, error) {
	switch w.Kind {
	case window.GlobalWindows:
		return &pipepb.FunctionSpec{
			Urn: URNGlobalWindowsWindowFn,
		}, nil
	case window.FixedWindows:
		return &pipepb.FunctionSpec{
			Urn: URNFixedWindowsWindowFn,

View on GitHub (pinned to 12126d8942)