{"record":{"id":"0fb62cf04838e7a4","repo":"temporalio/temporal","slug":"errduplicateregistration-0fb62c","errorCode":"ErrDuplicateRegistration","errorMessage":"%w: command handler for %v: %v","messagePattern":"%w: command handler for (.+?): (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"service/history/workflow/command_handler.go","lineNumber":44,"sourceCode":"\n// CommandHandlerRegistry maintains a mapping of command type to [CommandHandler].\ntype CommandHandlerRegistry struct {\n\thandlers map[enumspb.CommandType]CommandHandler\n}\n\n// NewCommandHandlerRegistry creates a new [CommandHandlerRegistry].\nfunc NewCommandHandlerRegistry() *CommandHandlerRegistry {\n\treturn &CommandHandlerRegistry{\n\t\thandlers: make(map[enumspb.CommandType]CommandHandler),\n\t}\n}\n\n// Register registers a [CommandHandler] for a given command type.\n// Returns an [ErrDuplicateRegistration] if a handler for the given command is already registered.\n// All registration is expected to happen in a single thread on process initialization.\nfunc (r *CommandHandlerRegistry) Register(t enumspb.CommandType, handler CommandHandler) error {\n\tif existing, ok := r.handlers[t]; ok {\n\t\treturn fmt.Errorf(\"%w: command handler for %v: %v\", ErrDuplicateRegistration, t, existing)\n\t}\n\tr.handlers[t] = handler\n\treturn nil\n}\n\n// Handler returns a [CommandHandler] for a given type and a boolean indicating whether it was found.\nfunc (r *CommandHandlerRegistry) Handler(t enumspb.CommandType) (handler CommandHandler, ok bool) {\n\thandler, ok = r.handlers[t]\n\treturn\n}\n","sourceCodeStart":26,"sourceCodeEnd":55,"githubUrl":"https://github.com/temporalio/temporal/blob/bde624efd13fbd3843654058db6d9c716166318b/service/history/workflow/command_handler.go#L26-L55","documentation":"Error \"%w: command handler for %v: %v\" thrown in temporalio/temporal.","triggerScenarios":"Thrown at service/history/workflow/command_handler.go:44 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"bde624efd13fbd3843654058db6d9c716166318b","analyzedAt":"2026-09-01T07:18:39.080Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}