policy_scope: The policy scope cannot take a policy

The budget carries no mandate (budgets opened before mandates existed) or has no signed budget record, or the organisation or team does not exist. A dry-run with a candidate document whose scope does not govern the budget answers the same code. Nothing changed.

A budget that is not on this deployment answers 404 not_found instead: every policy route looks the budget up first.

What to do

On the wire

HTTP 409, error type state_error. Without Dynamo-Error-Detail: 1 every client receives {"error": "state", "reason": "policy_scope", "detail": "…"} with no errorDetail: the policy routes add it only when the request sends that header, on a single-tenant core and on the hosted tier alike.

With Dynamo-Error-Detail: 1:

{
  "error": "state",
  "reason": "policy_scope",
  "detail": "…",
  "errorDetail": {
    "type": "state_error",
    "code": "policy_scope",
    "message": "…",
    "param": "policy",
    "doc_url": "…/errors/policy_scope.md",
    "fix": "the scope does not exist on this deployment, or the budget carries no mandate; policies govern mandated budgets and known organisations and teams"
  }
}

See policies and all error codes.