{"record":{"id":"23d056c56584788c","repo":"hibiken/asynq","slug":"queue-not-found","errorCode":null,"errorMessage":"queue not found","messagePattern":"queue not found","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"inspector.go","lineNumber":207,"sourceCode":"\tstats, err := i.rdb.HistoricalStats(queue, n)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar res []*DailyStats\n\tfor _, s := range stats {\n\t\tres = append(res, &DailyStats{\n\t\t\tQueue:     s.Queue,\n\t\t\tProcessed: s.Processed,\n\t\t\tFailed:    s.Failed,\n\t\t\tDate:      s.Time,\n\t\t})\n\t}\n\treturn res, nil\n}\n\nvar (\n\t// ErrQueueNotFound indicates that the specified queue does not exist.\n\tErrQueueNotFound = errors.New(\"queue not found\")\n\n\t// ErrQueueNotEmpty indicates that the specified queue is not empty.\n\tErrQueueNotEmpty = errors.New(\"queue is not empty\")\n\n\t// ErrTaskNotFound indicates that the specified task cannot be found in the queue.\n\tErrTaskNotFound = errors.New(\"task not found\")\n)\n\n// DeleteQueue removes the specified queue.\n//\n// If force is set to true, DeleteQueue will remove the queue regardless of\n// the queue size as long as no tasks are active in the queue.\n// If force is set to false, DeleteQueue will remove the queue only if\n// the queue is empty.\n//\n// If the specified queue does not exist, DeleteQueue returns ErrQueueNotFound.\n// If force is set to false and the specified queue is not empty, DeleteQueue\n// returns ErrQueueNotEmpty.","sourceCodeStart":189,"sourceCodeEnd":225,"githubUrl":"https://github.com/hibiken/asynq/blob/d135f1439bee74e989b7f9b41ecd542cc87f024a/inspector.go#L189-L225","documentation":"ErrQueueNotFound indicates the specified queue does not exist in Redis. Inspector operations (DeleteQueue, GetTaskInfo, List*Tasks) translate the internal redis queue-not-found error into this sentinel, often with the queue name appended.","triggerScenarios":"inspector.DeleteQueue(q, force) on a queue never created or already deleted; inspector.GetTaskInfo/ListPendingTasks on a queue name that has no stats key; typo'd queue name.","commonSituations":"Queues are created lazily on first enqueue, so inspecting a brand-new queue before any task exists; environment mismatch (inspecting against a different Redis DB than the producer); queue renamed in config.","solutions":["Verify the queue name matches the one used in asynq.Config queues and Enqueue calls.","Ensure the inspector connects to the same Redis instance/DB as the producer.","Enqueue a task (or check application flow) so the queue gets created before inspecting it.","Handle errors.Is(err, asynq.ErrQueueNotFound) as a non-fatal 'nothing to do' case."],"exampleFix":"// before\nif err := insp.DeleteQueue(\"dead_letter\", false); err != nil { log.Fatal(err) }\n// after\nerr := insp.DeleteQueue(\"dead_letter\", false)\nif errors.Is(err, asynq.ErrQueueNotFound) {\n    log.Println(\"queue does not exist; nothing to delete\")\n} else if err != nil {\n    log.Fatal(err)\n}","handlingStrategy":"type-guard","validationCode":"// Pre-check queue existence:\n_, err := insp.Stats(qname)\nexists := !errors.Is(err, asynq.ErrQueueNotFound)","typeGuard":"func isQueueNotFound(err error) bool { return errors.Is(err, asynq.ErrQueueNotFound) }","tryCatchPattern":"err := insp.DeleteQueue(q, false)\nif isQueueNotFound(err) { return nil }\nif err != nil { return err }","preventionTips":["Keep queue names in a shared constants/config package for producers and inspectors","Confirm Redis addresses/DB indexes match across services","Remember queues are created lazily on first enqueue"],"tags":["redis","queue","not-found","inspector"],"backgroundTag":"resource-not-found","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"}