{"record":{"id":"2fe0dc16202387b5","repo":"dgraph-io/dgraph","slug":"error-while-parsing-uid-s-of-groot-user","errorCode":null,"errorMessage":"Error while parsing Uid: %s of groot user","messagePattern":"Error while parsing Uid: (.+?) of groot user","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"edgraph/access.go","lineNumber":595,"sourceCode":"\tvar userResp userQryResp\n\tif err := json.Unmarshal(resp.GetJson(), &userResp); err != nil {\n\t\treturn errors.Wrap(err, \"Couldn't unmarshal response from groot user query\")\n\t}\n\tif len(userResp.GrootUser) == 0 {\n\t\t// no groot user found from query\n\t\t// Extract uid of created groot user from mutation\n\t\tnewUserUidMap := resp.GetUids()\n\t\tgrootUserUid = newUserUidMap[\"newuser\"]\n\t} else if len(userResp.GrootUser) == 1 {\n\t\t// we found a groot user\n\t\tgrootUserUid = userResp.GrootUser[0].Uid\n\t} else {\n\t\treturn errors.Wrap(err, \"Multiple groot users found\")\n\t}\n\n\tuid, err := strconv.ParseUint(grootUserUid, 0, 64)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"Error while parsing Uid: %s of groot user\", grootUserUid)\n\t}\n\tns, err := x.ExtractNamespace(ctx)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"While upserting user with id %s\", x.GrootId)\n\t}\n\tx.GrootUid.Store(ns, uid)\n\tglog.V(2).Infof(\"Successfully upserted groot account for namespace %d\\n\", ns)\n\treturn nil\n}\n\n// extract the userId, groupIds from the accessJwt in the context\nfunc extractUserAndGroups(ctx context.Context) (*userData, error) {\n\taccessJwt, err := x.ExtractJwt(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn validateToken(accessJwt)\n}","sourceCodeStart":577,"sourceCodeEnd":613,"githubUrl":"https://github.com/dgraph-io/dgraph/blob/759e242be62c91f8d084da06ad0c8d21256d9c07/edgraph/access.go#L577-L613","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await dg.alter(op) // triggers ACL bootstrap path\n} catch (e) {\n  if (/Error while parsing Uid/.test(e.message)) {\n    // groot uid corrupt: re-bootstrap ACLs on a clean namespace\n    console.error('corrupt groot uid, re-bootstrap ACLs:', e.cause ?? e)\n  }\n  throw e\n}","preventionTips":["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"],"tags":["acl","dgraph","uid","parse"],"backgroundTag":"acl-bootstrap-failure","analyzedSha":"759e242be62c91f8d084da06ad0c8d21256d9c07","analyzedAt":"2026-09-01T14:42:12.034Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}