{"record":{"id":"46f0d3236f2234b0","repo":"temporalio/temporal","slug":"unknown-task-category-type-v","errorCode":null,"errorMessage":"Unknown task category type: %v","messagePattern":"Unknown task category type: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"common/persistence/cassandra/mutable_state_task_store.go","lineNumber":743,"sourceCode":"\n\tif err := iter.Close(); err != nil {\n\t\treturn nil, gocql.ConvertError(operation, err)\n\t}\n\n\treturn response, nil\n}\n\nfunc (d *MutableStateTaskStore) getHistoryTasks(\n\tctx context.Context,\n\trequest *p.GetHistoryTasksRequest,\n) (*p.InternalGetHistoryTasksResponse, error) {\n\tswitch request.TaskCategory.Type() {\n\tcase tasks.CategoryTypeImmediate:\n\t\treturn d.getHistoryImmedidateTasks(ctx, request)\n\tcase tasks.CategoryTypeScheduled:\n\t\treturn d.getHistoryScheduledTasks(ctx, request)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Unknown task category type: %v\", request.TaskCategory.Type().String()))\n\t}\n}\n\nfunc (d *MutableStateTaskStore) getHistoryImmedidateTasks(\n\tctx context.Context,\n\trequest *p.GetHistoryTasksRequest,\n) (*p.InternalGetHistoryTasksResponse, error) {\n\t// execution manager should already validated the request\n\t// Reading history tasks need to be quorum level consistent, otherwise we could lose task\n\n\tquery := d.Session.Query(templateGetHistoryImmediateTasksQuery,\n\t\trequest.ShardID,\n\t\trequest.TaskCategory.ID(),\n\t\trowTypeHistoryTaskNamespaceID,\n\t\trowTypeHistoryTaskWorkflowID,\n\t\trowTypeHistoryTaskRunID,\n\t\tdefaultVisibilityTimestamp,\n\t\trequest.InclusiveMinTaskKey.TaskID,","sourceCodeStart":725,"sourceCodeEnd":761,"githubUrl":"https://github.com/temporalio/temporal/blob/bde624efd13fbd3843654058db6d9c716166318b/common/persistence/cassandra/mutable_state_task_store.go#L725-L761","documentation":"getHistoryTasks dispatches a GetHistoryTasksRequest to immediate or scheduled task queries based on the request's task category. Only CategoryTypeImmediate and CategoryTypeScheduled exist in the enum; any other value means a corrupted request or a stale enum, and the store panics. It is an exhaustive-switch invariant over a closed enum.","triggerScenarios":"Calling GetHistoryTasks with a request whose TaskCategory.Type() returns a value outside the two defined category types — e.g. a zero-value/nil-wrapped category or a request built by a mismatched proto version.","commonSituations":"Binary version skew between services sending new/unknown category values; constructing the request manually with an unset category; proto enum deserialization of an unknown value.","solutions":["Inspect how the GetHistoryTasksRequest was built and set TaskCategory to tasks.CategoryTypeImmediate or tasks.CategoryTypeScheduled","Check for version skew: services running different versions of the tasks enum","If a new category type was added, add a dispatch case to getHistoryTasks","Ensure request constructors, not raw struct literals, are used to build requests"],"exampleFix":"// before\ndefault:\n\tpanic(fmt.Sprintf(\"Unknown task category type: %v\", request.TaskCategory.Type().String()))\n// after\ndefault:\n\treturn nil, serviceerror.NewInternal(fmt.Sprintf(\"unknown task category type: %v\", request.TaskCategory.Type().String()))","handlingStrategy":"validation","validationCode":"if c := request.TaskCategory.Type(); c != tasks.CategoryTypeImmediate && c != tasks.CategoryTypeScheduled {\n\treturn fmt.Errorf(\"unsupported task category: %v\", c.String())\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Build requests via constructors that set a valid TaskCategory, not raw struct literals","Keep all services on compatible versions so the tasks enum cannot skew","When adding a category type, update every exhaustive switch over the enum"],"tags":["go","persistence","tasks","enum","panic"],"backgroundTag":"invalid-enum-value","analyzedSha":"bde624efd13fbd3843654058db6d9c716166318b","analyzedAt":"2026-09-01T07:18:39.080Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}