apache/beam · error
invalid bundle processing state: %d
Error message
invalid bundle processing state: %d
What it means
ExecutionMsecUrn converts an integer bundle-processing state (0..3) to its MonitoringInfo URN. Any other value is outside the defined enum and panics with this error. It signals an unexpected processing state value from monitoring data.
Source
Thrown at sdks/go/pkg/beam/core/runtime/metricsx/urns.go:185
if err := coder.EncodeVarInt(max, &buf); err != nil {
return nil, err
}
return buf.Bytes(), nil
}
// ExecutionMsecUrn returns the Urn for the bundle state
func ExecutionMsecUrn(i int) Urn {
switch i {
case 0:
return UrnStartBundle
case 1:
return UrnProcessBundle
case 2:
return UrnFinishBundle
case 3:
return UrnTransformTotalTime
default:
panic(fmt.Errorf("invalid bundle processing state: %d", i))
}
}
View on GitHub (pinned to 12126d8942)
Solutions
- Verify the state int passed comes from a valid MonitoringInfo MsecUrn enumeration (0-3).
- Upgrade the Go SDK if the runner emits newer state values.
- Check payload decoding — a decode bug can shift enum values by one.
- Recover from the panic at the metrics-ingestion boundary and skip the malformed sample.
Example fix
// before
urn := metricsx.ExecutionMsecUrn(state) // state from unvalidated data
// after
if state < 0 || state > 3 { return nil, fmt.Errorf("unknown state %d", state) }
urn := metricsx.ExecutionMsecUrn(state) Defensive patterns
Strategy: type-guard
Validate before calling
if state < 0 || state > 3 {
return fmt.Errorf("unsupported bundle processing state %d", state)
} Type guard
func validMsecState(i int) bool { return i >= 0 && i <= 3 } Try / catch
func safeUrn(i int) (urn string) {
defer func() { if r := recover(); r != nil { urn = "" } }()
return metricsx.ExecutionMsecUrn(i)
} Prevention
- Range-check state ints before calling ExecutionMsecUrn.
- Upgrade SDK when runners introduce new MsecUrn states.
- Verify monitoring payload decoding is byte-aligned.
When it happens
Trigger: Calling ExecutionMsecUrn with an int outside {0,1,2,3} — e.g. decoded monitoring payloads with unknown/corrupt state values or new enum values from a newer runner not supported by this SDK version.
Common situations: Version skew between runner and Go SDK introducing new MsecUrn states, or corrupted/misdecoded monitoring-info payloads.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- namespace and name are required to be non-empty, got %q and
- metric name %s being reused for a different metric type in a
- failed to deduce Step from MonitoringInfo: %v
- panic in ElementManager.Bundles watermark evaluation gorouti
- pipeline panicked: %v Stacktrace: %s
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/3ebb0113a690f7bb.
Report an issue: GitHub.