Skip to content

Troubleshooting

Why a request answers 404 or 403, why a list is empty, what withheld means, and how to fix PolicyInvalid, renamed groups, and level mismatches.

Updated

Most surprises have one of a few causes. When a decision surprises you, explain it: the explanation names the check, the pass, the statement, and the condition term that decided it.

404 or 403

Forge never tells a user about something that they can’t read, so a refusal comes in two kinds:

Answer Cause What to look at
OrgNotFound The user isn’t a member of the org, or lacks read on org. The org’s members, and read on org.
RepoNotFound The user can’t read the repo. read on repo: an org allow that covers the repo, and any org or repo deny on it.
CustomRecordNotFound, PolicyNotFound, and other 404 errors The user can’t read the record, or the repo that a policy belongs to, or it doesn’t exist. read on the model or the repo.
Forbidden The user reads the repo or the org and lacks the action. A schema, extension, or installation that the user can’t read also answers Forbidden. The action in the Action reference, and who allows it.
RecordWriteDenied The user reads the record and a policy refuses the write. Its model, record_id, and action name the write. The write’s allows and denies, on both sides of the write.

A write to a record that the user can’t read answers CustomRecordNotFound, not RecordWriteDenied, because a write needs read access to the record that it changes.

To tell a hidden resource from a missing one, simulate the same attempt as the member. A hidden verdict means the policies hide it. A not-found error means that it doesn’t exist, or that you can’t read it either.

A list is empty or short

Lists, searches, counts, and aggregates hold only the records that the user can read, so they never fail for a hidden record. When records are missing from a list, check these causes:

  • A deny on read for the model. A deny without a condition hides every record, while the model still shows in the schema.
  • A condition that meets a missing value. A deny whose condition compares a null field, such as invoice.submitted_by !== user.id on an invoice without a submitter, matches and hides the record. Test the case with === null to decide it on purpose. See Missing values.
  • A canRead that follows a reference. A record that reaches its access through canRead(invoice.project) hides when its reference is null, or when the user can’t read the record that it points to.
  • A repo that the user can’t read. forge repos list-repos shows only the repos that the user can read, so a hidden repo drops out of it.

Explain read on one missing record to find the statement that hides it.

Withheld

check-policy-simulation answers withheld, check-policy-explanation answers a Withheld explanation, and check-policy-diff leaves a change out, when the decision read something that you can’t read: a record that a condition reads, the target of a canRead, or a model that an exists scans or reaches through a reference, when a policy limits which of its rows you read. Your own access decides it, not the access of the member that you simulate.

To see the decision, ask someone who can read what it reads, such as an org owner. A draft that reads less, for example without an exists over a model that you can’t read in full, may not be withheld. See Withheld decisions.

PolicyInvalid

Saving a policy answers PolicyInvalid when the file has an error. Its problems are the ones that check-policy reports, each with a code, a message, a location, and often a fix. The common ones:

Problem Fix
repoAllow A repo policy holds only denies. Move the allow to an org policy, or write the rule as a deny with the exception in its condition.
orgActionInRepo Name org only in an org policy without repos. Split a policy that needs both into two.
repoModelInOrgPolicy Name a repo’s own model in a repo policy, or move the model into an extension.
truthiness Compare explicitly: record.approved_by !== null, not record.approved_by.
noRecord A condition reads record fields or changed on a statement that doesn’t name one model, or reads resource outside tools, workflows, schedules, triggers, and rooms. Name one model, or on models reach related records with exists.
unknownModel, unknownField Check the display name, spaces included, and whether the model is the repo’s own or an extension’s. An org policy resolves only released extension models.
unknownGroup No group has that name. Create the group first, or fix the spelling.
unknownTool, unknownWorkflow No version that the policy resolves against declares it. A repo policy reads the versions that the repo installs on main, and an org policy the latest releases. A prerelease declares nothing a policy can name, and a repo can’t install an extension that it defines. Install or release the version that declares it, and name an extension that the repo defines in an org policy that lists the repo.
unsupported, “holds exactly one policy” A file holds one policy. Split a file of several into one file each.
unsupported, “An org policy is made with orgPolicy” The file’s level doesn’t match the request. Save an orgPolicy without repo_id, and a repoPolicy with it.

What the checker refuses lists every code.

PolicyLevelMismatch

A policy keeps its level. PolicyLevelMismatch means a new version’s file holds the other kind (repoPolicy for an org policy, or orgPolicy for a repo policy), or a draft with policy_id holds the other kind or names a different repo than that policy’s. To change a policy’s level, create a policy at the new level and delete the old one.

Renamed or deleted groups

A policy stores each group that it names by id, in a principal such as group("Finance") and in a condition such as user.groups.includes("Finance"):

  • Renaming a group keeps every principal and condition that names it. forge policies list-policies shows them under the new name.
  • Deleting a group leaves its principals matching no one and makes user.groups.includes(...) false for everyone, so a deny that exempts the group with !user.groups.includes(...) then matches everyone. A new group that takes the old name gets none of them.
  • A policy that names a deleted group shows the group’s id in its source. Saving that source as a new version fails with unknownGroup, so remove the deleted group, or name another, before you save.

A condition never matches

The checker checks names, not values, so some rules save and never match:

  • A value that the field never holds. A picklist option that the field lacks, or a text field compared with a number, saves. === never matches it, and !== always does on a field that holds a value.
  • A missing value. In an allow, a comparison with null grants nothing.
  • An exists outside a model statement. exists(...) decides only in a statement on model(...) or models. On any other resource, such as repo, org, or allTools, the checker accepts it, but it errs with unresolvedName whenever a decision evaluates it. An allow then grants nothing, and a deny matches, so a deny on read on repo whose whole condition is an exists answers RepoNotFound to everyone that its policy names.

Explain the attempt and read each term’s value and operands.

SchemaChangeBreaksPolicy

Editing or deleting a custom field or model, renaming an extension, discarding working state, merging, or updating or uninstalling an installation answers 409 SchemaChangeBreaksPolicy when the change leaves a field or model in a policy covering the repo — the repo’s own or an org policy — unable to resolve. Deleting a model that a statement’s own resource names is allowed unless another statement’s condition reads it. Its problems name each broken policy; change or delete the policy first.

A rule changed after a schema change

The live policies decide every request, against the schema where Forge decides. When a branch, a commit, or an installed version lacks a field, model, or tool that a policy names, the name is an error there: an allow that names it or reads it grants nothing, and a deny that names it or reads it denies. Renaming a model’s display name doesn’t break a policy, because Forge stores a repo’s own models by id and extension models by API name.

To find a name that stopped resolving, read the policy’s source with forge policies get-policy and run check-policy on it.

Members can’t call tools or run automations

The default Editor policy allows records and repo work, not schema changes, extensions, tool calls, workflows, schedules, or triggers. Grant those in an org policy, as Let a group use an extension shows.

Someone denied their own access

A repo’s policy managers can deny anyone in the repo, themselves included, and nobody can save an allow in a repo policy. An org owner, whom no policy decides, restores access: delete the repo policy, or restore an earlier version with forge policies restore-policy-version. A member with managePolicies on the org can do the same only while they can read the repo. A repo that hides itself from them hides its policies too, and they get PolicyNotFound.

Type to search…

↑↓ navigate↵ selectEsc close