Skip to content

docs(errors): sync error reference with reviewed envelope behavior#185

Merged
duharry0915 merged 3 commits into
mainfrom
sid/agent-error-reference-updates
Jul 23, 2026
Merged

docs(errors): sync error reference with reviewed envelope behavior#185
duharry0915 merged 3 commits into
mainfrom
sid/agent-error-reference-updates

Conversation

@sidharth0612

@sidharth0612 sidharth0612 commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Summary

PR #183 merged on 07-10, before agentmail-api#586 went through its review rounds — several error behaviors changed during review, so the merged reference page describes the pre-review envelope. This syncs it to what the API branch now actually emits:

  • Intro example: matches the final merged wire shape — legacy name/message are preserved for backward compatibility (ForbiddenError / Forbidden; event-permission gates keep <permission> is forbidden), so the page teaches branch-on-code/fix, documents fix as optional, and the default fix carries the cannot-mint-a-key and scope caveats. (Earlier revisions of this PR tracked the mid-review subclass-name behavior; api#586 rounds 9–10 restored the legacy names for wire compatibility.)
  • missing_authorization: now three variants — missing header, wrong/missing case-sensitive Bearer scheme, or a correct scheme with an empty key value; the message states which.
  • missing_permission: fixes are cause-derived — a grantable permission missing from the key, a scope-derived denial (organization_read), a verification-gated permission (complete POST /v0/agent/verify first), or agent_verify itself (only available while an unverified agent org still needs verification).
  • unrestricted_key_required: covers all three gates (unrestricted child creation, permissions: null clear, modifying a currently-unrestricted key); the response fix says which fired.
  • message_rejected: distinguishes send block-list entries (DELETE /v0/lists/send/block/{entry} at the scope where the entry was created) from active allow-list misses (POST /v0/lists/send/allow — there is no block entry to delete).

Verified against agentmail-api afa5aa77: all 24 AGENT_ERROR_CODES have matching ### anchors on this page and vice versa.

Note: https://docs.agentmail.to/errors currently 404s even though #183 merged and the page is wired into docs.yml — the page doesn't appear to have been published to the live site yet, which is worth checking before agentmail-api#586 ships (every error response links to it).

🤖 Generated with Claude Code

PR #183 merged before the agentmail-api branch (sid/agent-friendly-errors,
PR #586) went through its review rounds; this catches the reference page up
to what the API now actually emits:

- Intro example: the wire emits the subclass name (MissingPermissionError,
  not ForbiddenError) and the default fix carries the scope caveat.
- missing_authorization: three variants (missing header, wrong/missing
  Bearer scheme, empty key after a correct scheme) — the message states
  which.
- missing_permission: fixes are cause-derived — grantable vs scope-derived
  vs verification-gated (POST /v0/agent/verify) vs agent_verify itself.
- unrestricted_key_required: covers all three gates (unrestricted child
  creation, permissions clear, modifying an unrestricted key); the fix says
  which fired.
- message_rejected: distinguishes send block-list entries (DELETE
  /v0/lists/send/block/{entry} at the creating scope) from active
  allow-list misses (POST /v0/lists/send/allow — nothing to delete).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

…ds 9-10)

- Intro example shows the actual wire shape: name 'ForbiddenError', message
  'Forbidden' — legacy name/message are preserved for compatibility, so the
  guidance is branch on code/fix, and fix is documented as optional.
- missing_permission: message stays 'Forbidden' (event gates keep
  '<permission> is forbidden'); the permission is named in fix.
- not_found documents the deliberate hiding of out-of-scope and
  restricted-label resources — a correct id can still 404.
- missing_authorization adds the whitespace-in-key variant.
- limit_exceeded documents the OTP live-vs-expired remedy split.
- conflict documents the failed-without-completing retry window.
- message_rejected: itemized — scope-aware block-entry DELETE paths (broader-
  scope entries need a broader-scoped key), read-only entries go to support,
  allow-list miss on unverified agent orgs points at verification.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

…arning

- api-403-error: teach read-the-fix first and distinguish the bodyless API
  gateway 403 from application 403s; cross-org resources are a deliberate
  404 not_found (only the inbox-key-on-pod-route case is a 403); suppressed
  recipients carry message_rejected with entry-specific remedies; and the
  'we do not restrict your API key' section is replaced — keys DO carry
  granular permissions now, with missing_permission naming the gap in fix.
- agent-onboarding: unverified sends no longer fail silently — they return
  message_rejected with a fix pointing at POST /v0/agent/verify.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

@duharry0915
duharry0915 merged commit 34baddf into main Jul 23, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants