{"record":{"id":"1f08f56312e232e4","repo":"temporalio/temporal","slug":"unknown-admin-batch-type-t","errorCode":null,"errorMessage":"unknown admin batch type: %T","messagePattern":"unknown admin batch type: %T","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"service/worker/batcher/activities.go","lineNumber":956,"sourceCode":"\tcase *adminservice.StartAdminBatchOperationRequest_RefreshTasksOperation:\n\t\treturn processTask(ctx, limiter, task,\n\t\t\tfunc(executionInfo *workflowpb.WorkflowExecutionInfo) error {\n\t\t\t\tarchetypeID, err := workercommon.ArchetypeIDFromExecutionInfo(executionInfo)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"archetypeID extraction error: %w\", err)\n\t\t\t\t}\n\t\t\t\t_, err = a.HistoryClient.RefreshWorkflowTasks(ctx, &historyservice.RefreshWorkflowTasksRequest{\n\t\t\t\t\tNamespaceId: batchOperation.NamespaceId,\n\t\t\t\t\tArchetypeId: uint32(archetypeID),\n\t\t\t\t\tRequest: &adminservice.RefreshWorkflowTasksRequest{\n\t\t\t\t\t\tNamespaceId: batchOperation.NamespaceId,\n\t\t\t\t\t\tExecution:   executionInfo.Execution,\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t\t\treturn err\n\t\t\t})\n\tdefault:\n\t\treturn fmt.Errorf(\"unknown admin batch type: %T\", adminReq.Operation)\n\t}\n}\n\nfunc processTask(\n\tctx context.Context,\n\tlimiter quotas.RequestRateLimiter,\n\ttask task,\n\tprocFn func(*workflowpb.WorkflowExecutionInfo) error,\n) error {\n\terr := limiter.Wait(ctx, batchQuotaRequest)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = procFn(task.executionInfo)\n\tif err != nil {\n\t\t// NotFound means wf is not running or deleted\n\t\tif !common.IsNotFoundError(err) {","sourceCodeStart":938,"sourceCodeEnd":974,"githubUrl":"https://github.com/temporalio/temporal/blob/bde624efd13fbd3843654058db6d9c716166318b/service/worker/batcher/activities.go#L938-L974","documentation":"processAdminTask dispatches an admin batch request based on the Go type of adminReq.Operation via a type switch. When the operation's concrete type does not match any known admin batch operation (e.g. RefreshWorkflowTasks), the default branch throws this error. It indicates the batcher was given an admin operation type it does not implement.","triggerScenarios":"Calling the batcher's admin task path (processAdminTask, reached via processSingleTask) with an adminReq whose Operation field holds an admin batch type not handled by the switch — for example a newly added admin operation type, or a nil/wrongly-constructed operation payload.","commonSituations":"Deploying a new Temporal version where the frontend emits an admin batch type the worker's batcher does not yet support; misconfigured batch admin tooling sending the wrong operation enum; tests like TestProcessAdminTask_UnknownOperation exercising the unknown-op path.","solutions":["Check the concrete type of the Operation being sent and use only admin batch types supported by this batcher version (e.g. RefreshWorkflowTasks).","Align worker and server versions: upgrade the batcher worker so its type switch covers any newly introduced admin batch operation types.","If you own the code, add a case to the type switch in processAdminTask handling the missing operation type.","Log/inspect %T in the error to identify exactly which type was passed and trace where it was constructed."],"exampleFix":"// before\nswitch adminReq.Operation.(type) {\ncase *batchspb.BatchOperationInput: ...\ndefault:\n  return fmt.Errorf(\"unknown admin batch type: %T\", adminReq.Operation)\n}\n// after\nswitch adminReq.Operation.(type) {\ncase *batchspb.BatchOperationInput: ...\ncase *adminspb.RefreshWorkflowTasksRequest: // newly supported type\n  ...\ndefault:\n  return fmt.Errorf(\"unknown admin batch type: %T\", adminReq.Operation)\n}","handlingStrategy":"type-guard","validationCode":"// validate the admin op before dispatch\nif adminReq.GetOperation() == nil {\n  return fmt.Errorf(\"admin batch operation is unset\")\n}\nswitch adminReq.Operation.(type) {\ncase *batchspb.BatchOperationInput:\n  // supported\ndefault:\n  return fmt.Errorf(\"unsupported admin batch type %T; upgrade worker\", adminReq.Operation)\n}","typeGuard":"func isAdminBatchOpSupported(op interface{}) bool {\n  switch op.(type) {\n  case *batchspb.BatchOperationInput:\n    return true\n  default:\n    return false\n  }\n}","tryCatchPattern":"if err := batcher.ProcessAdminTask(ctx, adminReq); err != nil {\n  if strings.Contains(err.Error(), \"unknown admin batch type\") {\n    logger.Error(\"batcher does not support this admin op; upgrade worker\", tag.Error(err))\n    return\n  }\n  return err\n}","preventionTips":["Keep batcher worker versions in lockstep with server releases that add admin batch types.","Log %T of the operation when constructing admin batch requests to catch wrong types early.","Add unit tests covering every supported admin operation type in the switch.","Never send an unset Operation field."],"tags":["go","batch","type-switch","unsupported-operation"],"backgroundTag":"unsupported-operation-for-type","analyzedSha":"bde624efd13fbd3843654058db6d9c716166318b","analyzedAt":"2026-09-01T07:18:39.080Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}