apache/beam · error

session windowing is not supported for side inputs

Error message

session windowing is not supported for side inputs

What it means

When a ParDo consumes side inputs, the pipeline translation must express a window mapping URN (global/fixed/sliding) in the portable representation. Session windowing has no corresponding side-input mapping in the runner protocol, so translation panics for window.Sessions.

Source

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

			Payload: []byte(mustEncodeMultiEdge),
		},
		AccumulatorCoderId: acID,
	}
	transform.Spec = &pipepb.FunctionSpec{Urn: URNCombinePerKey, Payload: protox.MustEncode(payload)}
	return nil
}

func getSideWindowMappingUrn(winFn *window.Fn) string {
	var mappingUrn string
	switch winFn.Kind {
	case window.GlobalWindows:
		mappingUrn = URNWindowMappingGlobal
	case window.FixedWindows:
		mappingUrn = URNWindowMappingFixed
	case window.SlidingWindows:
		mappingUrn = URNWindowMappingSliding
	case window.Sessions:
		panic("session windowing is not supported for side inputs")
	}
	return mappingUrn
}

func (m *marshaller) addMultiEdge(edge NamedEdge) ([]string, error) {
	handleErr := func(err error) ([]string, error) {
		return nil, errors.Wrapf(err, "failed to add input kind: %v", edge)
	}
	id := edgeID(edge.Edge)
	if _, exists := m.transforms[id]; exists {
		return []string{id}, nil
	}

	switch {
	case edge.Edge.Op == graph.CoGBK && len(edge.Edge.Input) > 1:
		cogbkID, err := m.expandCoGBK(edge)
		if err != nil {
			return handleErr(err)

View on GitHub (pinned to 12126d8942)

Solutions

  1. Restructure the pipeline so the side input comes from a non-session-windowed PCollection (e.g. re-window to fixed or global windows)
  2. Explode session results into elements and join via CoGBK instead of side inputs
  3. Pre-compute side-input data in a separate stage with global or fixed windows

Example fix

// before
beam.WindowInto(scope, window.NewSessions(5*time.Minute), side)
// after
side = beam.WindowInto(scope, window.NewFixedWindows(5*time.Minute), side)
Defensive patterns

Strategy: validation

Validate before calling

if isSessionWindowed(sideInputPCol) {
    return errors.New("side inputs cannot use session windows; re-window to fixed/global")
}

Type guard

func isSessionWindowed(ws window.WindowingStrategy) bool {
    _, ok := ws.WindowFn.(window.Sessions); return ok
}

Try / catch

defer func() { if r := recover(); r != nil { err = fmt.Errorf("side input translation: %v", r) } }()

Prevention

When it happens

Trigger: Building a pipeline where a DoFn accesses a side input (beam.SideInput) from a PCollection windowed with window.NewSessions(...) — detected in getSideWindowMappingUrn during addMultiEdge.

Common situations: Combining session windows with side-input lookups in the same stage; copying a side-input pattern from fixed-window code into session-windowed pipelines.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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