Budibase/budibase · error
Email is required
Error message
Email is required
What it means
fromScimUser maps a SCIM user payload to a Budibase User and requires an email address. tryGetEmail looks across userName/emails etc.; if no email can be extracted the mapping cannot proceed, so it throws. SCIM identity without email cannot be represented as a Budibase user.
Source
Thrown at packages/pro/src/mappers/users.ts:81
return user.userName
}
if (!user.emails) {
return undefined
}
return user.emails.find(x => x.primary)?.value || user.emails[0]?.value
}
export const fromScimUser = (
scimUser: ScimUserResponse | ScimCreateUserRequest,
roles: User["roles"] = {}
): User => {
const existingUser = isScimUserResponse(scimUser) ? scimUser : undefined
const email = tryGetEmail(scimUser)
if (!email) {
throw new Error("Email is required")
}
let isActive
switch (scimUser.active) {
case "True":
case "true":
case true:
isActive = true
break
case "False":
case "false":
case false:
isActive = false
break
default:
unreachable(scimUser.active)
}
View on GitHub (pinned to a81a902e9a)
Solutions
- Fix the IdP SCIM attribute mapping so email is sent — map mail/userPrincipalName to userName or emails[primary].
- Correct the SCIM payload to include "emails":[{"value":"...","primary":true}] or a valid userName that is an email.
- Check tryGetEmail's accepted shapes (userName, emails with value) and conform the client payload to them.
- Pre-validate SCIM payloads and reject/skip users without email at the sync layer with a clearer report.
Example fix
// before
{ "schemas": ["urn:...:2.0:User"], "name": { "givenName": "Jo" }, "active": true }
// after
{ "schemas": ["urn:...:2.0:User"], "userName": "jo@example.com", "emails": [{ "value": "jo@example.com", "primary": true }], "active": true } Defensive patterns
Strategy: validation
Validate before calling
function scimUserHasEmail(u: any): boolean {
return Boolean(u?.userName || (Array.isArray(u?.emails) && u.emails.some(e => e?.value)))
} Type guard
function hasEmail(u: SCIMUserResponse): u is SCIMUserResponse & { email: string } {
return typeof tryGetEmail(u) === "string" && tryGetEmail(u)!.includes("@")
} Try / catch
try {
const user = fromScimUser(scimPayload)
} catch (e) {
if (e.message === "Email is required") {
reportSyncIssue(`SCIM user ${scimPayload.id} has no email`)
} else throw e
} Prevention
- Map email to userName and emails[primary] in your IdP SCIM connector
- Dry-run SCIM sync and flag users missing email before provisioning
- Validate payloads against the SCIM core schema in tests
When it happens
Trigger: POST/PUT to SCIM /Users with a payload lacking userName and emails entries (or only entries without a value/type), or a SCIM client sending users with empty email attributes during provisioning sync.
Common situations: IdP (Okta, Azure AD, JumpCloud) SCIM connector misconfigured to not map email to userName or emails[primary]; test payloads omitting email; attribute mapping changed in the IdP after initial setup.
Related errors
- Configuration invalid. Must contain google clientID and clie
- Configuration invalid. Must contain clientID, clientSecret,
- Password change is disabled for this user
- No user ID provided for getting
- A new verification key is required when changing the embed S
AI-assisted analysis of Budibase/budibase@a81a902e9a (2026-08-29).
Data as JSON: /api/errors/797c1823026159dd.
Report an issue: GitHub.