Budibase/budibase · error

Unable to un-assign roles - license required.

Error message

Unable to un-assign roles - license required.

What it means

The counterpart to roles.assign, roles.unAssign is also gated behind the license-gated 'expanded public API' feature. If isExpandedPublicApiEnabled() returns false for the tenant, the call throws before reading users. The message distinguishes it from the assign variant so logs show which direction of role assignment was refused.

Source

Thrown at packages/pro/src/sdk/publicApi/roles.ts:51

    }
    if (opts.builder) {
      user.builder = {
        global: true,
      }
    }
    if (opts.admin) {
      user.admin = {
        global: true,
      }
    }
    user.roles
  }
  await userDB.bulkUpdate(users)
}

export async function unAssign(userIds: string[], opts: AssignmentOpts) {
  if (!(await isExpandedPublicApiEnabled())) {
    throw new Error("Unable to un-assign roles - license required.")
  }
  const users = await userDB.bulkGet(userIds)
  for (let user of users) {
    if (opts.role) {
      const prodWorkspaceId = dbCore.getProdWorkspaceID(opts.role?.appId)
      if (user.roles[prodWorkspaceId] === opts.role.roleId) {
        delete user.roles[prodWorkspaceId]
      }
    }
    if (opts.appBuilder && user.builder?.apps) {
      const prodWorkspaceId = dbCore.getProdWorkspaceID(opts.appBuilder.appId)
      user.builder.apps = user.builder.apps.filter(
        appId => appId !== prodWorkspaceId
      )
    }
    if (opts.builder && user.builder) {
      delete user.builder
    }

View on GitHub (pinned to a81a902e9a)

Solutions

  1. Upgrade the tenant's license to include expanded public API access
  2. Force a license re-check/re-activation so the feature flag updates
  3. Perform role un-assignment via the builder UI or internal SDK instead of the public API
  4. Catch this error in integrations and prompt the user about the missing entitlement
Defensive patterns

Strategy: validation

Validate before calling

const enabled = await isExpandedPublicApiEnabled()
if (!enabled) throw new Error("Expanded public API requires a license upgrade")

Try / catch

try {
  await roles.unAssign(userIds, opts)
} catch (err: any) {
  if (err.message === "Unable to un-assign roles - license required.") {
    // fall back to builder UI / internal API
  } else { throw err }
}

Prevention

When it happens

Trigger: Calling roles.unAssign (removing a role from users via the public API) on a tenant without the expanded public API entitlement; expired license causing the feature check to fail.

Common situations: Automation scripts revoking app roles via public REST API on a free/self-host tier; license downgrade removing the add-on mid-integration; cached license state stale after upgrade so flag still reads disabled.

Related errors


AI-assisted analysis of Budibase/budibase@a81a902e9a (2026-08-29). Data as JSON: /api/errors/fee47d0ead93982b. Report an issue: GitHub.