dgraph-io/dgraph · error

Got error while running mutation

Error message

Got error while running mutation

What it means

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.

Source

Thrown at worker/draft.go:609

		for end < len(m.Edges) && sameAttrAndUid(end, end-1) {
			end++
		}

		numChanCreated += 1
		go func(start, end int) {
			errCh <- process(m.Edges[start:end])
		}(i, end)
		i = end
	}
	// Earlier we were returning after even if one thread had an error. We should wait for
	// all the transactions to finish. We call txn.Update() when this function exists. This could cause
	// a deadlock with runMutation.
	var errs error
	for range numChanCreated {
		if err := <-errCh; err != nil {
			if errs == nil {
				errs = errors.New("Got error while running mutation")
			}
			errs = errors.Wrap(err, errs.Error())
		}
	}
	return errs
}

func (n *node) applyCommitted(proposal *pb.Proposal, key uint64) error {
	start := time.Now()
	defer func() {
		since := time.Since(start)
		if since > 30*time.Second {
			glog.Warningf("applyCh entry took [%v] to handle: %#v", since, proposal)
		}
	}()

	ctx := n.Ctx(key)
	span := trace.SpanFromContext(ctx)

View on GitHub (pinned to 759e242be6)

Solutions

  1. Read the wrapped cause after 'Got error while running mutation:' to find the real error (schema, disk, etc.).
  2. Fix the underlying schema/type mismatch (e.g. add the predicate via alter) and re-run the client operation.
  3. Check disk space and memory on the node if the cause indicates storage failure.
  4. Retry the client transaction with a new StartTs after fixing the root cause.

Example fix

// cause example fix: predicate missing
// before: writing 'rating' edge with no schema
client.Mutate(mutation{Set: []NQuad{{Predicate: "rating"}}})
// after: define schema first
client.Alter("rating: float .")
client.Mutate(mutation{Set: []NQuad{{Predicate: "rating"}}})
Defensive patterns

Strategy: try-catch

Try / catch

try { await client.mutate(txn) } catch (e) {
  if (e.message.includes('Got error while running mutation')) {
    const cause = e.message.split('Got error while running mutation: ')[1]
    log.error('mutation root cause:', cause)
  }
}

Prevention

When it happens

Trigger: 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.

Common situations: Writing edges without the predicate's schema (NoGraphQL/unknown predicate); type mismatches between stored and new schema; disk full during trieblox writes.

Related errors


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