apache/beam · error

Unknown WindowInto option type: %T

Error message

Unknown WindowInto option type: %T: %v

What it means

beam.TryWindowInto accepts windowing options (trigger, accumulation mode, allowed lateness, etc.) and panics when it encounters an option value of a type it does not recognize. This indicates a bad or unsupported value was passed as a WindowInto option, or a new option type exists that this code path doesn't handle.

Solutions

  1. Use the exported option constructors (windowing.Trigger, accumulation mode, allowed lateness helpers) instead of raw values.
  2. Check the %T in the message to see which wrong type was passed.
  3. Update to a Beam version where the option type you need is supported.
  4. Wrap the WindowInto call in a recover in library code and report the unsupported option.

Example fix

// before
beam.WindowInto(s, window.WhenDuration(30*time.Second), col) // not a supported option type
// after
beam.WindowInto(s, window.FixedWindows(30*time.Second), col)
Defensive patterns

Strategy: validation

Validate before calling

// Only pass option values produced by the windowing package's constructors,
// never raw durations or custom structs:
opt := window.Trigger.Default() // use exported constructors only

Type guard

// No reliable runtime type guard outside beam; restrict option construction to
// the package's exported option types (trigger, accumulationMode, allowedLateness).

Try / catch

defer func() {
    if r := recover(); r != nil {
        if s, ok := r.(string); ok && strings.Contains(s, "Unknown WindowInto option type") {
            log.Fatalf("bad windowing option: %s", s)
        }
        panic(r)
    }
}()

Prevention

When it happens

Trigger: Passing an unexpected value as a WindowIntoOption to beam.WindowInto / TryWindowInto — e.g. a raw duration, nil option, or a custom struct instead of the provided trigger/accumulationMode/allowedLateness option constructors.

Common situations: Hand-rolling option values instead of using the exported option helpers; copying option code from an older Beam version where option types changed; typos creating plain values where option wrappers are expected.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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

Appendix: source

Thrown at sdks/go/pkg/beam/windowing.go:100

		return PCollection{}, errors.New("invalid scope")
	}
	if !col.IsValid() {
		return PCollection{}, errors.New("invalid input pcollection")
	}
	ws := window.WindowingStrategy{Fn: wfn, Trigger: trigger.DefaultTrigger{}}
	for _, opt := range opts {
		switch opt := opt.(type) {
		case windowTrigger:
			// TODO(BEAM-3304): call validation on trigger construction here
			// so local errors can be returned to the user in their pipeline
			// context instead of at pipeline translation time.
			ws.Trigger = opt.trigger
		case accumulationMode:
			ws.AccumulationMode = opt.mode
		case allowedLateness:
			ws.AllowedLateness = int(opt.delay / time.Millisecond)
		default:
			panic(fmt.Sprintf("Unknown WindowInto option type: %T: %v", opt, opt))
		}
	}

	edge := graph.NewWindowInto(s.real, s.scope, &ws, col.n)
	ret := PCollection{edge.Output[0].To}
	return ret, nil
}

View on GitHub (pinned to 12126d8942)