dgraph-io/dgraph · error
task queue hasn't been initialized yet
Error message
task queue hasn't been initialized yet
What it means
Enqueue checks for a nil receiver; if the task queue (t) is nil it means the task queue was never initialized (e.g. when no WAL store is configured, such as running without the necessary storage setup). It returns this error instead of panicking on the nil pointer.
Source
Thrown at worker/queue.go:133
// tasks is a persistent task queue.
type tasks struct {
// queue stores the full Protobuf request.
queue chan taskRequest
// log stores the timestamp, TaskKind, and TaskStatus.
log *z.Tree
logMu *sync.Mutex
rng *rand.Rand
}
// Enqueue adds a new task to the queue, waits for 3 seconds, and returns any errors that
// may have happened in that span of time. The request must be of type:
// - *pb.BackupRequest
// - *pb.ExportRequest
func (t *tasks) Enqueue(req interface{}) (uint64, error) {
if t == nil {
return 0, fmt.Errorf("task queue hasn't been initialized yet")
}
id, err := t.enqueue(req)
if err != nil {
return 0, err
}
// Wait for upto 3 seconds to check for errors.
for range 3 {
time.Sleep(time.Second)
t.logMu.Lock()
meta := TaskMeta(t.log.Get(id))
t.logMu.Unlock()
// Early return
switch meta.Status() {
case TaskStatusFailed:View on GitHub (pinned to 759e242be6)
Solutions
- Verify the Alpha is started in a mode that initializes the task queue (check startup logs for task/queue init)
- Upgrade/fix deployment so the WAL store is configured — the queue depends on it
- Do not call Enqueue on a zero-value worker.tasks; obtain the queue from the server's initialized field
- Guard callers with a nil check and surface a clearer configuration error
Example fix
// before
id, err := tasks.Enqueue(req)
// after
if tasks == nil {
return 0, fmt.Errorf("backup/export not supported: task queue not initialized on this Alpha")
}
id, err := tasks.Enqueue(req) Defensive patterns
Strategy: type-guard
Validate before calling
// Nil-check before use (mirrors the library's own guard)
if tasks == nil {
return 0, fmt.Errorf("task queue not initialized on this Alpha")
} Type guard
func queueReady(t *worker.Tasks) bool { return t != nil } Try / catch
id, err := tasks.Enqueue(req)
if err != nil {
if strings.Contains(err.Error(), "hasn't been initialized") {
return fmt.Errorf("backup/export unsupported in this deployment mode")
}
return err
} Prevention
- Confirm the Alpha runs in a mode that initializes the task queue
- Check startup logs for task-queue initialization before offering backup/export
- In embedded use, always construct the tasks struct via its constructor, never a zero value
When it happens
Trigger: Calling Enqueue (with a *pb.BackupRequest or *pb.ExportRequest) on a tasks instance that is nil — i.e. the server-side queue was never constructed/assigned, commonly when the node lacks the store backing t.log.
Common situations: Calling backup/export against an Alpha that started without task-queue initialization (e.g. reduced setup where the queue isn't wired); a library/embedded use of worker where tasks were never created; race where queue init hasn't run yet at startup.
Related errors
- Exceeded query edge limit = %v. Found %v edges.
- cannot parse backup location
- no backup manifests found at location %s
- illegal rune found "%c", expecting {
- JSON map is followed by illegal rune "%c"
AI-assisted analysis of dgraph-io/dgraph@759e242be6 (2026-09-01).
Data as JSON: /api/errors/ceef32d55d05e261.
Report an issue: GitHub.