{"record":{"id":"d6de842918a036c4","repo":"dgraph-io/dgraph","slug":"another-operation-is-already-running","errorCode":null,"errorMessage":"another operation is already running","messagePattern":"another operation is already running","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"worker/draft.go","lineNumber":139,"sourceCode":"\t\tn.opsLock.Lock()\n\t\tdelete(n.ops, id)\n\t\tn.opsLock.Unlock()\n\t\tglog.Infof(\"Operation completed with id: %s\", id)\n\n\t\t// Resume rollups if another operation is being stopped.\n\t\tif id != opRollup {\n\t\t\ttime.Sleep(10 * time.Second) // Wait for 10s to start rollup operation.\n\t\t\t// If any other operation is running, this would error out. This error can\n\t\t\t// be safely ignored because rollups will resume once that other task is done.\n\t\t\t_, _ = n.startTask(opRollup)\n\t\t}\n\t}\n\n\tcloser := z.NewCloser(1)\n\tswitch id {\n\tcase opRollup:\n\t\tif len(n.ops) > 0 {\n\t\t\treturn nil, errors.Errorf(\"another operation is already running\")\n\t\t}\n\t\tgo posting.IncrRollup.Process(closer, State.GetTimestamp)\n\tcase opRestore:\n\t\t// Restores cancel all other operations, except for other restores since\n\t\t// only one restore operation should be active any given moment.\n\t\tfor otherId, otherOp := range n.ops {\n\t\t\tif otherId == opRestore {\n\t\t\t\treturn nil, errors.Errorf(\"another restore operation is already running\")\n\t\t\t}\n\t\t\t// Remove from map and signal the closer to cancel the operation.\n\t\t\tdelete(n.ops, otherId)\n\t\t\totherOp.SignalAndWait()\n\t\t}\n\tcase opBackup:\n\t\t// Backup cancels all other operations, except for other backups since\n\t\t// only one backup operation should be active any given moment. Also, indexing at higher\n\t\t// timestamp can also run concurrently with backup.\n\t\tfor otherId, otherOp := range n.ops {","sourceCodeStart":121,"sourceCodeEnd":157,"githubUrl":"https://github.com/dgraph-io/dgraph/blob/759e242be62c91f8d084da06ad0c8d21256d9c07/worker/draft.go#L121-L157","documentation":"Raised in startTaskAtTs (worker/draft.go:139) when a rollup operation is requested but the node already has one or more operations registered in n.ops. Dgraph permits only one operation task of certain kinds at a time; rollup refuses to start while any other operation is active.","triggerScenarios":"Calling startTask(opRollup) (via worker-task grpc/alpha operation endpoints like /alter rollup or TaskRequest) while a rollup, restore, backup, indexing, snapshot or predicate-move operation is still tracked in n.ops.","commonSituations":"Scheduling overlapping rollup cycles after long-running restores/backups; slow rollups on large predicates that outlast the cron interval; multiple admins triggering rollup concurrently.","solutions":["Wait for the in-flight operation to finish before starting rollup, or check its status first.","If a previous operation is stuck, restart the affected Dgraph node/Zero group member to clear n.ops state.","Increase the rollup cron interval so consecutive rollups do not overlap.","Reduce backup/restore/indexing concurrency so rollup can acquire the single operation slot."],"exampleFix":"// before: immediate overlapping rollup call\nclient.StartTask(opRollup)\n// after: retry until the current operation completes\nerr := client.StartTask(opRollup)\nif err != nil && strings.Contains(err.Error(), \"another operation is already running\") {\n    time.Sleep(30 * time.Second)\n    err = client.StartTask(opRollup)\n}","handlingStrategy":"retry","validationCode":"if activeOperations(cluster).length > 0 { throw new Skip(\"operation in progress\") }","typeGuard":null,"tryCatchPattern":"err := client.StartTask(opRollup)\nif err != nil && strings.Contains(err.Error(), \"another operation is already running\") {\n    time.Sleep(1 * time.Minute)\n    return client.StartTask(opRollup)\n}","preventionTips":["Serialize admin operations through a single scheduler per cluster.","Set rollup cron intervals longer than worst-case rollup duration.","Poll operation status before launching new ones."],"tags":["dgraph","operation-conflict","rollup"],"backgroundTag":"operation-already-running","analyzedSha":"759e242be62c91f8d084da06ad0c8d21256d9c07","analyzedAt":"2026-09-01T14:42:12.034Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}