# X_TENANCY_UNSCOPED

## Means

a tenant-scoped query has no org predicate

## Typical cause

a repo call outside any request context, so there is no actor to derive the tenant from; a plan handed to the verify-only `assertScoped()` while an actor *is* present; or an `upsertAll(rows, { onMatch: 'update' })` whose `onConflict` omits the tenant column — a collision there lands on another tenant's row

## Fix

the cause says which of the two it is. No context: `runWithContext(ctxOf({ actor }), fn)` from the script or seed. Actor present: build the plan through `scopedPlan()`, or `orgScoped(plan, ctx.actor.orgId)`. For the upsert: put the tenant column in `onConflict`

[Policy and authz](/error-codes#policy-and-authz)
