dgraph-io/dgraph · error
Error while parsing Uid: %s of groot user
Error message
Error while parsing Uid: %s of groot user
What it means
After resolving groot's user uid, upsertGroot parses it with strconv.ParseUint. If the stored uid string is empty or not a valid unsigned integer, this wrapped error is returned. It signals malformed uid data for the groot user rather than a caller mistake.
Source
Thrown at edgraph/access.go:595
var userResp userQryResp
if err := json.Unmarshal(resp.GetJson(), &userResp); err != nil {
return errors.Wrap(err, "Couldn't unmarshal response from groot user query")
}
if len(userResp.GrootUser) == 0 {
// no groot user found from query
// Extract uid of created groot user from mutation
newUserUidMap := resp.GetUids()
grootUserUid = newUserUidMap["newuser"]
} else if len(userResp.GrootUser) == 1 {
// we found a groot user
grootUserUid = userResp.GrootUser[0].Uid
} else {
return errors.Wrap(err, "Multiple groot users found")
}
uid, err := strconv.ParseUint(grootUserUid, 0, 64)
if err != nil {
return errors.Wrapf(err, "Error while parsing Uid: %s of groot user", grootUserUid)
}
ns, err := x.ExtractNamespace(ctx)
if err != nil {
return errors.Wrapf(err, "While upserting user with id %s", x.GrootId)
}
x.GrootUid.Store(ns, uid)
glog.V(2).Infof("Successfully upserted groot account for namespace %d\n", ns)
return nil
}
// extract the userId, groupIds from the accessJwt in the context
func extractUserAndGroups(ctx context.Context) (*userData, error) {
accessJwt, err := x.ExtractJwt(ctx)
if err != nil {
return nil, err
}
return validateToken(accessJwt)
}View on GitHub (pinned to 759e242be6)
Solutions
- Log/print grootUserUid to see the bad value; empty string usually means the preceding mutation failed — check its err before this point
- Re-run ACL bootstrap on a healthy cluster so the groot uid is assigned properly
- Verify the ACL schema (dgraph.xid, dgraph.password, dgraph.group.acl predicates) exists after any restore/migration
- Restart the zero/alpha group if uid assignment is failing transiently
Defensive patterns
Strategy: try-catch
Try / catch
try {
await dg.alter(op) // triggers ACL bootstrap path
} catch (e) {
if (/Error while parsing Uid/.test(e.message)) {
// groot uid corrupt: re-bootstrap ACLs on a clean namespace
console.error('corrupt groot uid, re-bootstrap ACLs:', e.cause ?? e)
}
throw e
} Prevention
- Check wrapped cause errors on mutation responses rather than ignoring them
- Verify ACL schema predicates exist after any restore/migration
- Keep Dgraph versions consistent between zero and alphas to avoid malformed internal responses
When it happens
Trigger: upsertGroot runs, finds exactly one groot user (or a fresh mutation response), but newUserUidMap["newuser"] or userResp.GrootUser[0].Uid is empty/non-numeric — e.g. the mutation assigning uid 'newuser' failed silently or the query projected no uid.
Common situations: Mutation response missing 'uids' map because the create mutation errored; schema missing dgraph.xid/uid facets after restore; partially applied ACL schema from an older Dgraph version.
Related errors
- UID must to be greater than 0
- Multiple groot users found
- Argument cannot be "uid"
- error querying old ACL rules: %w
- unable to parse ACLs: %v
AI-assisted analysis of dgraph-io/dgraph@759e242be6 (2026-09-01).
Data as JSON: /api/errors/2fe0dc16202387b5.
Report an issue: GitHub.