Budibase/budibase · error
User revision missing
Error message
User revision missing
What it means
assignCreatedUsersToWorkspace fetches each newly created user via users.get(createdUser._id) to obtain its _rev, which is mandatory for addUserToWorkspace. If the fetch returns nothing or a doc without _rev it throws 'User revision missing'. This typically indicates the just-created user could not be read back.
Source
Thrown at packages/builder/src/settings/pages/people/users/workspaceInviteUtils.ts:397
matchingUser?.role,
matchingUser?.appRole
)
const useGroupWorkspaceRole = shouldUseGroupWorkspaceRole({
workspaceId,
role: matchingUser?.role,
appRole: matchingUser?.appRole,
selectedGroupIds,
allGroups,
})
if (useGroupWorkspaceRole) {
return null
}
if (!role) {
return null
}
const fullUser = await users.get(createdUser._id)
if (!fullUser?._rev) {
throw new Error("User revision missing")
}
await users.addUserToWorkspace(createdUser._id, role, fullUser._rev)
return createdUser.email
})
)
const addedToWorkspaceEmails = assignmentResults
.filter(
(result): result is PromiseFulfilledResult<string | null> =>
result.status === "fulfilled"
)
.map(result => result.value)
.filter((email): email is string => !!email)
return {
addedToWorkspaceEmails,
assignedCount: addedToWorkspaceEmails.length,
failedCount: assignmentResults.filter(View on GitHub (pinned to a81a902e9a)
Solutions
- Retry the users.get call after creation (small delay or retry loop) to obtain _rev.
- Verify the user was actually created successfully before attempting workspace assignment; handle creation failures per user.
- Take _rev directly from the create-user API response when available instead of re-fetching.
Example fix
// before
const fullUser = await users.get(createdUser._id)
if (!fullUser?._rev) { throw new Error("User revision missing") }
// after
let fullUser = await users.get(createdUser._id)
if (!fullUser?._rev) { await new Promise(r => setTimeout(r, 500)); fullUser = await users.get(createdUser._id) }
if (!fullUser?._rev) { return null } Defensive patterns
Strategy: retry
Validate before calling
const fullUser = await users.get(createdUser._id) if (!fullUser?._rev) return null // skip this user and report it // proceed only when _rev exists
Type guard
const isStoredUser = (u: Partial<User>): u is User & { _id: string; _rev: string } =>
typeof u._id === "string" && typeof u._rev === "string" && u._rev.length > 0 Try / catch
try {
await users.addUserToWorkspace(createdUser._id, role, fullUser._rev)
} catch (e) {
if (e.message === "User revision missing") {
await sleep(500)
const retried = await users.get(createdUser._id)
if (retried?._rev) return users.addUserToWorkspace(createdUser._id, role, retried._rev)
return null
}
throw e
} Prevention
- Take _rev from the create-user response when available to avoid the read-back race.
- Add a short retry/delay when reading back freshly created users.
- Verify each user creation succeeded before scheduling its workspace assignment.
When it happens
Trigger: After batch user creation, users.get(createdUser._id) for one of the created users returns undefined or a document without _rev — e.g. eventual consistency delay, creation partially failed, or the API response lacked _rev.
Common situations: Bulk invite where one user creation silently failed but the id was still processed; DB replication lag right after creation; permission restrictions on reading the new user document.
Related errors
- User ID or revision missing
- User ID missing
- Cannot render an empty flow chain
- Source table '${relationship.sourceTable}' not found in data
- Target table '${relationship.targetTable}' not found in data
AI-assisted analysis of Budibase/budibase@a81a902e9a (2026-08-29).
Data as JSON: /api/errors/e4f3552ee6420e9d.
Report an issue: GitHub.