{"record":{"id":"0d07b00b9d980a57","repo":"dgraph-io/dgraph","slug":"got-error-while-running-mutation","errorCode":null,"errorMessage":"Got error while running mutation","messagePattern":"Got error while running mutation","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"worker/draft.go","lineNumber":609,"sourceCode":"\n\t\tfor end < len(m.Edges) && sameAttrAndUid(end, end-1) {\n\t\t\tend++\n\t\t}\n\n\t\tnumChanCreated += 1\n\t\tgo func(start, end int) {\n\t\t\terrCh <- process(m.Edges[start:end])\n\t\t}(i, end)\n\t\ti = end\n\t}\n\t// Earlier we were returning after even if one thread had an error. We should wait for\n\t// all the transactions to finish. We call txn.Update() when this function exists. This could cause\n\t// a deadlock with runMutation.\n\tvar errs error\n\tfor range numChanCreated {\n\t\tif err := <-errCh; err != nil {\n\t\t\tif errs == nil {\n\t\t\t\terrs = errors.New(\"Got error while running mutation\")\n\t\t\t}\n\t\t\terrs = errors.Wrap(err, errs.Error())\n\t\t}\n\t}\n\treturn errs\n}\n\nfunc (n *node) applyCommitted(proposal *pb.Proposal, key uint64) error {\n\tstart := time.Now()\n\tdefer func() {\n\t\tsince := time.Since(start)\n\t\tif since > 30*time.Second {\n\t\t\tglog.Warningf(\"applyCh entry took [%v] to handle: %#v\", since, proposal)\n\t\t}\n\t}()\n\n\tctx := n.Ctx(key)\n\tspan := trace.SpanFromContext(ctx)","sourceCodeStart":591,"sourceCodeEnd":627,"githubUrl":"https://github.com/dgraph-io/dgraph/blob/759e242be62c91f8d084da06ad0c8d21256d9c07/worker/draft.go#L591-L627","documentation":"Raised in applyMutations (worker/draft.go:609): after dispatching mutations to runMutation goroutines, any error read from errCh causes a wrapped aggregate error with this top-level message, while preserving the underlying cause text.","triggerScenarios":"Any per-mutation failure during applying a committed Raft proposal — e.g. schema mismatch on edge write, invalid NQuad, predicate serving failures, out-of-memory/disk errors during index building.","commonSituations":"Writing edges without the predicate's schema (NoGraphQL/unknown predicate); type mismatches between stored and new schema; disk full during trieblox writes.","solutions":["Read the wrapped cause after 'Got error while running mutation:' to find the real error (schema, disk, etc.).","Fix the underlying schema/type mismatch (e.g. add the predicate via alter) and re-run the client operation.","Check disk space and memory on the node if the cause indicates storage failure.","Retry the client transaction with a new StartTs after fixing the root cause."],"exampleFix":"// cause example fix: predicate missing\n// before: writing 'rating' edge with no schema\nclient.Mutate(mutation{Set: []NQuad{{Predicate: \"rating\"}}})\n// after: define schema first\nclient.Alter(\"rating: float .\")\nclient.Mutate(mutation{Set: []NQuad{{Predicate: \"rating\"}}})","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { await client.mutate(txn) } catch (e) {\n  if (e.message.includes('Got error while running mutation')) {\n    const cause = e.message.split('Got error while running mutation: ')[1]\n    log.error('mutation root cause:', cause)\n  }\n}","preventionTips":["Ensure all predicates used in mutations have schemas defined.","Watch disk and memory headroom on alphas.","Log and read the wrapped cause to identify the true failing mutation.","Retry client transactions with fresh start timestamps after failures."],"tags":["dgraph","mutations","raft"],"backgroundTag":"mutation-apply-failed","analyzedSha":"759e242be62c91f8d084da06ad0c8d21256d9c07","analyzedAt":"2026-09-01T14:42:12.034Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}