{"record":{"id":"27cc4f0127a5cd67","repo":"apache/beam","slug":"batch-groupintobatchesbufferedfn-unexpected-timer-family-q","errorCode":null,"errorMessage":"batch.groupIntoBatchesBufferedFn: unexpected timer family %q","messagePattern":"batch\\.groupIntoBatchesBufferedFn: unexpected timer family %q","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/transforms/batch/batch.go","lineNumber":427,"sourceCode":"\t\tfn.flush(sp, tp, key, emit)\n\t\treturn\n\t}\n\tif fn.BatchSizeBytes > 0 && newBytes >= fn.BatchSizeBytes {\n\t\tfn.flush(sp, tp, key, emit)\n\t\treturn\n\t}\n}\n\nfunc (fn *groupIntoBatchesBufferedFn) OnTimer(\n\tctx context.Context, ts beam.EventTime, sp state.Provider, tp timers.Provider,\n\tkey typex.T, timer timers.Context, emit func(typex.T, []typex.V),\n) {\n\tfn.codec.init(fn.ValueType.T)\n\tswitch timer.Family {\n\tcase fn.Buffering.Family, fn.WindowEnd.Family:\n\t\tfn.flush(sp, tp, key, emit)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\n\t\t\t\"batch.groupIntoBatchesBufferedFn: unexpected timer family %q\", timer.Family))\n\t}\n}\n\nfunc (fn *groupIntoBatchesBufferedFn) flush(\n\tsp state.Provider, tp timers.Provider, key typex.T, emit func(typex.T, []typex.V),\n) {\n\tbuf, ok, err := fn.Buffer.Read(sp)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tif !ok || len(buf) == 0 {\n\t\treturn\n\t}\n\n\tout := make([]typex.V, len(buf))\n\tfor i, b := range buf {\n\t\tout[i] = fn.codec.decode(b)","sourceCodeStart":409,"sourceCodeEnd":445,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/transforms/batch/batch.go#L409-L445","documentation":"This panic fires in OnTimer when the delivered timer's Family matches neither fn.Buffering.Family nor fn.WindowEnd.Family. The DoFn only knows how to handle its own two timer families; an unknown family means a misconfigured or foreign timer is firing for this step, and the library treats it as an unrecoverable internal bug.","triggerScenarios":"A timer callback delivers a family string that does not equal the Buffering or WindowEnd family — e.g. the pipeline was updated and an old version of the same step left timers with changed family names firing against new code, or a runner reuses/delivers timer IDs incorrectly.","commonSituations":"Job update (drain + restart with modified code) where the timer family string changed between versions; state/timer resurrection after job migration; runner bugs delivering stale timers from a previous job to a recycled worker.","solutions":["Check whether the pipeline was updated between versions with changed timer family names; do a clean restart (drain, cancel all state, fresh job) instead of in-place update.","Verify no other DoFn/transform shares the same step and timer namespace.","Report to the runner if stale timers from a cancelled job are still firing.","Upgrade Beam to get family-name stability fixes for job updates.","As a diagnostic, log timer.Family before the switch to identify its origin."],"exampleFix":"// before: family names changed across a job update\nfn.Buffering = tm.ProcessTime(\"buf_v2\")\n// after: keep family names stable across deployments, or fully restart the job\nfn.Buffering = tm.ProcessTime(\"buffering\") // same family name as previous version","handlingStrategy":"validation","validationCode":"// Before switching job code in-place, diff timer family names between old and\n// new versions; if changed, plan a full drain + fresh job restart instead.","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never rename timer family strings across job updates on the same state.","Drain and fully restart jobs (discarding old timers) after timer changes.","Avoid reusing step/state namespaces across unrelated transforms.","Log timer.Family on unexpected values to speed diagnosis."],"tags":["go","apache-beam","timers","panic","job-update"],"backgroundTag":"invalid-enum-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"}