{"record":{"id":"4f90144d1048f14d","repo":"hibiken/asynq","slug":"task-typename-cannot-be-empty","errorCode":null,"errorMessage":"task typename cannot be empty","messagePattern":"task typename cannot be empty","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client.go","lineNumber":390,"sourceCode":"\n// EnqueueContext enqueues the given task to a queue.\n//\n// EnqueueContext returns TaskInfo and nil error if the task is enqueued successfully, otherwise returns a non-nil error.\n//\n// The argument opts specifies the behavior of task processing.\n// If there are conflicting Option values the last one overrides others.\n// Any options provided to NewTask can be overridden by options passed to Enqueue.\n// By default, max retry is set to 25 and timeout is set to 30 minutes.\n//\n// If no ProcessAt or ProcessIn options are provided, the task will be pending immediately.\n//\n// The first argument context applies to the enqueue operation. To specify task timeout and deadline, use Timeout and Deadline option instead.\nfunc (c *Client) EnqueueContext(ctx context.Context, task *Task, opts ...Option) (*TaskInfo, error) {\n\tif task == nil {\n\t\treturn nil, fmt.Errorf(\"task cannot be nil\")\n\t}\n\tif strings.TrimSpace(task.Type()) == \"\" {\n\t\treturn nil, fmt.Errorf(\"task typename cannot be empty\")\n\t}\n\t// merge task options with the options provided at enqueue time.\n\topts = append(task.opts, opts...)\n\topt, err := composeOptions(opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdeadline := noDeadline\n\tif !opt.deadline.IsZero() {\n\t\tdeadline = opt.deadline\n\t}\n\ttimeout := noTimeout\n\tif opt.timeout != 0 {\n\t\ttimeout = opt.timeout\n\t}\n\tif deadline.Equal(noDeadline) && timeout == noTimeout {\n\t\t// If neither deadline nor timeout are set, use default timeout.\n\t\ttimeout = defaultTimeout","sourceCodeStart":372,"sourceCodeEnd":408,"githubUrl":"https://github.com/hibiken/asynq/blob/d135f1439bee74e989b7f9b41ecd542cc87f024a/client.go#L372-L408","documentation":"Argument validation in EnqueueContext: the task's type name (its typename given to NewTask) is empty. The type name identifies which handler processes the task, so an empty name would produce an unprocessable task and is rejected at enqueue time.","triggerScenarios":"Thrown at client.go:390 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a non-empty typename to asynq.NewTask, e.g. asynq.NewTask(\"email:welcome\", payload)","Validate task.Type() before enqueueing when the task is built dynamically"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"d135f1439bee74e989b7f9b41ecd542cc87f024a","analyzedAt":"2026-09-07T19:02:34.660Z","contentChangedAt":"2026-09-07T19:02:34.660Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}