{"record":{"id":"9eee965604ed0a55","repo":"temporalio/temporal","slug":"unknown-timer-task","errorCode":null,"errorMessage":"unknown timer task","messagePattern":"unknown timer task","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"service/history/tasks/utils.go","lineNumber":126,"sourceCode":"\t\teventID = common.FirstEventID\n\tcase *DeleteHistoryEventTask:\n\t\t// Retention task will be used by chasm framework as well,\n\t\t// and it doesn't depend on any particular state (thus eventID) of the run.\n\t\treturn getChasmTaskEventID()\n\tcase *StateMachineTimerTask:\n\t\teventID = common.FirstEventID\n\tcase *TimeSkippingTimerTask:\n\t\t// time skipping timer tasks supports both for workflow and chasm executions,\n\t\t// and it doesn't depend on eventID, so it uses the dummy chasm task eventID here.\n\t\treturn getChasmTaskEventID()\n\tcase *ChasmTaskPure:\n\t\treturn getChasmTaskEventID()\n\tcase *ChasmTask:\n\t\treturn getChasmTaskEventID()\n\tcase *FakeTask:\n\t\t// no-op\n\tdefault:\n\t\tpanic(serviceerror.NewInternal(\"unknown timer task\"))\n\t}\n\treturn eventID, true\n}\n","sourceCodeStart":108,"sourceCodeEnd":130,"githubUrl":"https://github.com/temporalio/temporal/blob/bde624efd13fbd3843654058db6d9c716166318b/service/history/tasks/utils.go#L108-L130","documentation":"GetTimerTaskEventID is the timer-task analogue of GetTransferTaskEventID: it maps timer Task implementations (UserTimers, ActivityTimers, WorkflowTaskTimers, WorkflowTimeoutTimers, ActivityTimeoutTimers, ChasmTasks, etc.) to their originating event ID. An unhandled timer task concrete type falls into the default branch and panics with an internal error.","triggerScenarios":"Passing a timer Task whose concrete type is missing from the type switch into GetTimerTaskEventID — via Tags() when processing timer tasks, usually after a new timer task type was introduced in one version and processed by another.","commonSituations":"Upgrades where a new timer task type exists in persistence and is loaded by an older binary; fork-specific timer tasks; nil or wrongly-typed tasks placed in the timer queue.","solutions":["Add a case for the new timer task type returning its event ID (or a sentinel like getChasmTaskEventID equivalent).","Upgrade all history nodes to a version that recognizes the task type (fix version skew).","Inspect the task row in persistence to confirm the type is legitimate and not corrupt.","Add an exhaustiveness unit test covering every timer task implementation in the tasks package."],"exampleFix":"// before\ncase *ChasmTask:\n    return getChasmTaskEventID()\ndefault:\n    panic(serviceerror.NewInternal(\"unknown timer task\"))\n\n// after\ncase *ChasmTask:\n    return getChasmTaskEventID()\ncase *NewTimerTask:\n    eventID = task.GetTaskID() // or appropriate event source\ndefault:\n    panic(serviceerror.NewInternal(\"unknown timer task\"))","handlingStrategy":"type-guard","validationCode":"switch t.(type) {\ncase *tasks.UserTimerTask, *tasks.ActivityTimeoutTask, *tasks.WorkflowTaskTimeoutTask, *tasks.ChasmTask:\n    // safe to call\ndefault:\n    return fmt.Errorf(\"timer task type %T unsupported\", t)\n}","typeGuard":"func isKnownTimerTask(t tasks.Task) bool {\n    switch t.(type) {\n    case *tasks.UserTimerTask, *tasks.ActivityTimeoutTask,\n        *tasks.WorkflowTaskTimeoutTask, *tasks.WorkflowTimeoutTask,\n        *tasks.ActivityTimeoutTask, *tasks.ChasmTask, *tasks.FakeTask:\n        return true\n    }\n    return false\n}","tryCatchPattern":null,"preventionTips":["Update GetTimerTaskEventID whenever a new timer task struct is added","Upgrade all nodes together; unknown types usually indicate version skew","Add an exhaustiveness unit test covering every timer task type","Check persistence rows for unexpected type values before processing"],"tags":["timer-task","panic","type-switch","history-service","version-skew"],"backgroundTag":"unknown-task-type","analyzedSha":"bde624efd13fbd3843654058db6d9c716166318b","analyzedAt":"2026-09-01T07:18:39.080Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}