---
title: "IdentityHound errors"
description: "Look up an IdentityHound error code or access-check reason to learn what it means and what to do next."
url: "https://agentpost.tools/docs/identityhound/errors"
kind: errors
---

# IdentityHound errors

Every error code IdentityHound answers with has an entry here, with its HTTP status in bold, what it means, and what to do. Act on the error’s `error.code`. The body’s `error.docs` links straight to the entry, such as `https://agentpost.tools/docs/identityhound/errors#last_owner`, and [API basics](/docs/platform/api-basics.md#errors) describes the body.

## Error codes

### `invalid_request`

**400.** The body, query, or path is malformed. `details.issues` lists each field that failed and why.

**What to do:** Fix the fields named in `details.issues` and send the request again.

### `idempotency_mismatch`

**409.** This `Idempotency-Key` was already used for a different request. Within 24 hours, the same caller’s key on the same operation must come with the same path, query, body, and `If-Match`. Creating a grant keeps its key with no time limit, and its reference entry says what it compares.

**What to do:** Use a new key for a new request. Reuse a key only to retry the exact same request.

### `stale_version`

**409.** The config changed since you read it: `If-Match` names an older version.

**What to do:** Read the config again, apply your change to it, and send it with the new version.

### `payload_too_large`

**413.** The request body is over 1 MiB.

**What to do:** Send less in one request. For an import, split the principals across several calls; each is idempotent by `externalRef`, so a call that repeats one changes nothing.

### `unauthenticated`

**401.** The request has no credential, or its token is unknown, expired, or revoked.

**What to do:** Send `Authorization: Bearer <token>`. If the token was valid before, sign in again or exchange for a new delegated token.

### `secret_key_invalid`

**401.** Agentpost refused the project’s secret key: it is unknown, revoked, or expired, belongs to the other environment, or its project was deleted. This is your server’s configuration, not the visitor’s session: a session that ended answers `unauthenticated` instead.

**What to do:** Check that your server sends a current secret key for the environment it calls, `sk_test_…` for `dev` and `sk_live_…` for `prd`. Issue a new key in the console if it was revoked or expired. Retrying with the same secret key fails the same way; once your server sends a valid one, a retry with the same `Idempotency-Key` runs again.

### `forbidden`

**403.** The caller is known but may not do this. When an access check refused it, `details.reason` holds the check’s reason.

**What to do:** Read `details.reason` and look it up under check reasons. An agent with too little scope requests a delegation; it does not retry.

### `trusted_caller_required`

**403.** The operation is for the project’s own server, and the caller is a principal.

**What to do:** Call it from your server with the project’s secret key. A retry with the same `Idempotency-Key` runs again, rather than answering `trusted_caller_required` from the first try.

### `not_found`

**404.** The record doesn’t exist, or the caller may not know it exists.

**What to do:** Check the ID. Don’t retry with the same one.

### `conflict`

**409.** The request clashes with the current state, such as a role already held, an archived workspace, a delegated token asked for before the delegation is approved, or the same `Idempotency-Key` still in progress.

**What to do:** Read the message, fetch the record’s current state, and decide again. For a key still in progress, retry shortly.

### `cursor_expired`

**410.** The change feed already removed events after this cursor, so reading on would skip changes. The feed keeps events for 30 days. `details.oldest` is the first `seq` still kept, and `details.latest` the newest.

**What to do:** Bring your records up to date from the records themselves, such as with `GET /sessions/:id` for each session you keep. Then read on with `after` set to `details.oldest - 1`, to keep the changes still in the feed, or with `after=latest`, to start from now. Read more often than every 30 days so it doesn’t happen again.

### `code_invalid`

**400.** The sign-in code is wrong, or no code was sent for this verification. Each wrong guess counts against the verification, and `details.guessesLeft` says how many it has left.

**What to do:** While `details.guessesLeft` is above 0, ask the principal to check the code, and send the right one with the same `verificationId`. After the last guess, when `guessesLeft` is 0, or with no `guessesLeft` because no code was sent for this verification, request a new code.

### `code_expired`

**400.** The sign-in code expired.

**What to do:** Request a new code.

### `sign_up_closed`

**403.** No account has this identity, and the project’s sign-up mode doesn’t let new principals in.

**What to do:** Invite the principal, or change `signUp.mode` in the config if new principals should join without an invitation.

### `sign_in_disabled`

**403.** This way of signing in is off for the project.

**What to do:** Turn it on in the config, or offer another way to sign in.

### `identity_in_use`

**409.** The email or provider login already belongs to another account. When a guest tried to sign in, the guest stays as it was. When a signed-in principal linked it, the other account is another active principal, and the project sets `accounts.merge` to `on`, `details` holds a merge ticket: `mergeTicket`, its `expiresAt`, and `heldBy`, the other account’s ID.

**What to do:** Sign in to the existing account without the guest session. To keep what the guest holds, call `POST /me/merge-guest` from that account. With a merge ticket, ask the principal whether to merge the other account into its own, and if it agrees, send the ticket to `POST /me/merge` before it expires.

### `last_sign_in_method`

**409.** Removing this identity or revoking this key would leave the principal without a way to sign in.

**What to do:** Link an identity that the project accepts for sign-in, or issue an API key without an expiry before removing this method.

### `throttled`

**429.** Too many requests of this kind, from this address or for this target.

**What to do:** Wait `details.retryAfter` seconds, then try again. A retry with the same `Idempotency-Key` runs again, rather than answering `throttled` from the first try.

### `merge_blocked`

**409.** The other account holds something a merge won’t hand over, so nothing moved. `details.blockers` lists each: an active API key of its own (`api_key`), an active delegation it is part of (`delegation`), a role on a resource that the signed-in account also holds there in another workspace or outside any (`resource_role`), or more owned workspaces than `workspaces.maxOwnedPerPrincipal` allows once merged (`workspace_limit`).

**What to do:** Have the principal end each blocker from the other account: revoke the key or the delegation, remove one of the two resource roles, or archive a workspace or hand it to another owner. Then link the sign-in method again for a new ticket if this one expired, and merge.

### `guests_disabled`

**403.** Guests are off for the project, or the caller is already signed in.

**What to do:** Turn guests on in the config, or don’t start a guest for someone who is signed in.

### `guest_limit`

**429.** The project has reached its cap on live guests.

**What to do:** Ask the principal to sign in, or raise `guests.maxActive` in the config. A retry with the same `Idempotency-Key` runs again once there is room.

### `provider_unknown`

**404.** No provider app has this key in the config.

**What to do:** Check the provider key, or add the provider app to the config.

### `provider_disabled`

**403.** The provider app is off, or isn’t set up for this purpose, such as signing in.

**What to do:** Turn it on in the config, or use it only for what it allows.

### `provider_error`

**502.** The OAuth provider failed or refused the request.

**What to do:** Retry later; a retry with the same `Idempotency-Key` asks the provider again. If it keeps failing, check the provider app’s client ID and secret.

### `return_to_not_allowed`

**400.** `returnTo` is not one of the configured OAuth return URLs.

**What to do:** Use a configured URL, or add this one to the config.

### `oauth_state_invalid`

**400.** The OAuth `state` is unknown, already used, expired, or from another browser.

**What to do:** Start the flow again from the same browser.

### `last_owner`

**409.** A workspace keeps at least one owner.

**What to do:** Make another member an owner first.

### `not_a_member`

**404.** The principal is not a member of the workspace.

**What to do:** Check the member ID, or add the principal first.

### `role_not_assignable`

**422.** The role isn’t one for this place, such as a resource role given in a workspace, or the role’s `assignableTo` leaves out the principal: a guest where it doesn’t list `guest`, or any other principal where it doesn’t list `principal`.

**What to do:** Pick a role the config defines for this scope and opens to this principal. A guest that signs in is no longer a guest.

### `workspace_limit`

**403.** The principal already owns as many active workspaces as `workspaces.maxOwnedPerPrincipal` in the config allows, so a request that would give it another to own is refused. `details.limit` holds the limit. Archived workspaces don’t count.

**What to do:** Have the principal archive or leave a workspace it owns, or hand it to another owner, then try again. Or raise `workspaces.maxOwnedPerPrincipal`.

### `invitation_invalid`

**404.** No invitation matches this token.

**What to do:** Ask for a new invitation.

### `invitation_not_pending`

**409.** The invitation was already accepted, revoked, or expired.

**What to do:** Ask for a new invitation.

### `invitation_email_mismatch`

**403.** An email invitation needs its address as one of the principal’s verified identities.

**What to do:** Add and verify that address with `POST /me/identities/email`, then accept again.

### `invitation_not_open`

**403.** The invitation’s `openTo` leaves out this principal: it is open only to guests, and the principal is not one, or only to principals that are not guests, and the principal is a guest.

**What to do:** A guest signs in first. Otherwise, ask for an invitation open to this principal.

### `entitlement_unknown`

**422.** The entitlement is not in the config’s catalog.

**What to do:** Check the key, or add the entitlement to the config.

### `bundle_retired`

**409.** The bundle is retired: it can’t be granted or changed, and its existing grants stay as history but give nothing.

**What to do:** Grant a current bundle.

### `grant_not_active`

**409.** The grant is already revoked or expired.

**What to do:** Nothing to do; create a new grant if the holder should have it.

### `config_invalid`

**422.** The config has problems. `details.issues` lists each with its path.

**What to do:** Fix each issue. `POST /config/validate` checks a config without saving it.

### `connection_needs_reauth`

**409.** The provider refused to refresh the connected account, so its tokens no longer work, such as after the principal disconnected the app.

**What to do:** Ask the principal to connect the account again.

### `internal_error`

**500.** Something failed on our side.

**What to do:** Retry with the same `Idempotency-Key`. If it keeps failing, contact [hello@agentpost.tools](mailto:hello@agentpost.tools).

## Check reasons

An access check, [`POST /access/check`](/docs/identityhound/reference/access.md#check-access), answers `allowed` and a `reason`. When an operation is refused by a check, the `forbidden` error carries the same reason in `details.reason`.

### `project_role`

Allowed by a role the principal holds across the whole project.

**What to do:** Proceed.

### `workspace_role`

Allowed by the principal’s role in the resource’s workspace.

**What to do:** Proceed.

### `resource_role`

Allowed by a role on this resource, held by the principal, or by every principal that is not a guest, or by every guest when the principal is one.

**What to do:** Proceed.

### `unknown_permission`

The config has no such resource type or action.

**What to do:** Check the spelling, or add the action to the resource type in the config.

### `principal_inactive`

The principal is suspended or deleted, or its ID names no principal.

**What to do:** Your server can reactivate a suspended principal.

### `actor_inactive`

The delegate acting for the principal is suspended or deleted, or no principal has its ID.

**What to do:** Your server can reactivate a suspended principal.

### `delegation_missing`

The delegate acts for another principal but no active delegation from that principal covers it.

**What to do:** Request a delegation with `POST /delegations/requests`, then wait for the principal to approve it.

### `delegation_expired`

The delegation the delegate acts under has expired.

**What to do:** Request a new delegation.

### `delegation_scope`

The delegation doesn’t include this permission, even if the principal holds it.

**What to do:** Request a delegation that names this permission. Don’t retry the action.

### `delegation_workspace`

The delegation is for a different workspace than the resource.

**What to do:** Request a delegation for this workspace.

### `credential_restricted`

The API key’s restrictions leave out this permission or this workspace.

**What to do:** Use a key whose restrictions cover it, or ask the key’s owner to issue one.

### `no_access`

No role the principal holds grants the permission: not its workspace role, if it has one, nor a resource role or a project role.

**What to do:** Give the principal a role that grants it: add or invite it to the workspace, change its workspace role, or give it a resource role. Or change the role’s permissions in the config. `explain: true` shows which roles were checked.

### `workspace_archived`

The resource’s workspace is archived, and an archived workspace grants nothing. Something from it would have allowed this: the principal’s membership, a delegation for that workspace, or a resource role assigned there. A project role, or a resource role assigned outside any workspace, still applies.

**What to do:** Treat the workspace as closed, since it stays archived. To change its members or other records, call with your secret key.

### `entitlement_missing`

The principal may do this, but the action needs an entitlement that nobody granted it, its workspace, or every principal that is not a guest (every guest, when the principal is one).

**What to do:** Grant the entitlement or a bundle containing it, such as on purchase.
