temporalio/temporal · error
ErrDuplicateRegistration
ErrDuplicateRegistration
Error message
%w: command handler for %v: %v
What it means
Error "%w: command handler for %v: %v" thrown in temporalio/temporal.
Source
Thrown at service/history/workflow/command_handler.go:44
// CommandHandlerRegistry maintains a mapping of command type to [CommandHandler].
type CommandHandlerRegistry struct {
handlers map[enumspb.CommandType]CommandHandler
}
// NewCommandHandlerRegistry creates a new [CommandHandlerRegistry].
func NewCommandHandlerRegistry() *CommandHandlerRegistry {
return &CommandHandlerRegistry{
handlers: make(map[enumspb.CommandType]CommandHandler),
}
}
// Register registers a [CommandHandler] for a given command type.
// Returns an [ErrDuplicateRegistration] if a handler for the given command is already registered.
// All registration is expected to happen in a single thread on process initialization.
func (r *CommandHandlerRegistry) Register(t enumspb.CommandType, handler CommandHandler) error {
if existing, ok := r.handlers[t]; ok {
return fmt.Errorf("%w: command handler for %v: %v", ErrDuplicateRegistration, t, existing)
}
r.handlers[t] = handler
return nil
}
// Handler returns a [CommandHandler] for a given type and a boolean indicating whether it was found.
func (r *CommandHandlerRegistry) Handler(t enumspb.CommandType) (handler CommandHandler, ok bool) {
handler, ok = r.handlers[t]
return
}
View on GitHub (pinned to bde624efd1)
When it happens
Trigger: Thrown at service/history/workflow/command_handler.go:44 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of temporalio/temporal@bde624efd1 (2026-09-01).
Data as JSON: /api/errors/0fb62cf04838e7a4.
Report an issue: GitHub.