dgraph-io/dgraph · error

cannot start backup operation

Error message

cannot start backup operation

What it means

Before running a backup, the worker tries to acquire the opBackup task at the requested timestamp via startTaskAtTs. If the node is already running another task (e.g. an ongoing backup, export, or snapshot) at that timestamp, the operation cannot be started and the underlying error is wrapped with this message.

Source

Thrown at worker/backup.go:195

	glog.Infof("Backup request: group %d at %d", req.GroupId, req.ReadTs)
	if err := ctx.Err(); err != nil {
		glog.Errorf("Context error during backup: %v\n", err)
		return nil, err
	}

	g := groups()
	if g.groupId() != req.GroupId {
		return nil, errors.Errorf("Backup request group mismatch. Mine: %d. Requested: %d\n",
			g.groupId(), req.GroupId)
	}

	if err := posting.Oracle().WaitForTs(ctx, req.ReadTs); err != nil {
		return nil, err
	}

	closer, err := g.Node.startTaskAtTs(opBackup, req.ReadTs)
	if err != nil {
		return nil, errors.Wrapf(err, "cannot start backup operation")
	}
	defer closer.Done()

	bp := NewBackupProcessor(pstore, req)
	defer bp.Close()

	return bp.WriteBackup(closer.Ctx())
}

// BackupGroup backs up the group specified in the backup request.
func BackupGroup(ctx context.Context, in *pb.BackupRequest) (*pb.BackupResponse, error) {
	glog.V(2).Infof("Sending backup request: %+v\n", in)
	if groups().groupId() == in.GroupId {
		return backupCurrentGroup(ctx, in)
	}

	// This node is not part of the requested group, send the request over the network.
	pl := groups().AnyServer(in.GroupId)

View on GitHub (pinned to 759e242be6)

Solutions

  1. Wait for the currently running backup/task on that node to finish, then retry
  2. Ensure only one backup is triggered at a time per group (serialize backup jobs)
  3. Inspect the inner error from startTaskAtTs to identify the conflicting task
  4. Restart the worker if a stale task entry is blocking new backups
Defensive patterns

Strategy: retry

Validate before calling

// ensure no backup task is already running for this group before issuing
if taskRunning(opBackup) {
    return errors.New("a backup operation is already in progress; wait and retry")
}

Try / catch

resp, err := BackupGroup(ctx, req)
if err != nil && strings.Contains(err.Error(), "cannot start backup operation") {
    time.Sleep(backoff)
    resp, err = BackupGroup(ctx, req) // retry after the conflicting task completes
}

Prevention

When it happens

Trigger: Calling Backup/BackupGroup when the target node already has a conflicting task registered at opBackup with the same ReadTs — typically a concurrent backup or another long-running operation holding the task slot.

Common situations: Two admins trigger backups simultaneously; a previous backup hung and still holds the task; automated jobs overlap with manual backups; ReadTs collides with an in-flight operation after a retry.

Related errors


AI-assisted analysis of dgraph-io/dgraph@759e242be6 (2026-09-01). Data as JSON: /api/errors/be4f994aaea36e1d. Report an issue: GitHub.