Skip to content
Documentation menu: Error codes

Error codes

Every surface returns the exact same machine-readable error envelope. Branch control flow on code and details, never on human prose in message.

41 stable codesAppend-only contractRegistry 2026-11-29.2

KernelErrorShape contract#

REST v2 error bodies, MCP isError: true tool results, @honeloop/sdkexceptions and hl CLI JSON error envelopes all carry the exact same five-field object: code, message, optional remediation, optionaldetails and optional retry_after (integer seconds).

  • No correlation_id in the body: the correlation ID travels in the X-Correlation-Id HTTP response header (and in MCP result_meta) on every response, success or failure.
  • Append-only codes: shipped codes are never renamed, removed or reassigned to a different HTTP status. Clients must handle unknown future codes gracefully by HTTP status class.
  • approval_required is not an error: policy diversion is a success-shaped HTTP 202 response documented inApprovals and autonomy.

Example error response (HTTP 403)

{
  "code": "scope_missing",
  "message": "Principal lacks required scope approvals:decide.",
  "remediation": {
    "hint": "Authenticate with a reviewer principal holding approvals:decide."
  },
  "details": {
    "required_scope": "approvals:decide",
    "held_scopes": ["posts:read", "posts:write", "posts:publish", "channels:read"]
  }
}

Live preflight validator#

Honeloop validates every post against the destination channel's manifest before scheduling or calling an upstream platform. Pick a platform and edit the draft below to watch the response switch between 400 validation_failed (with rule_id and remediation) and 200 ok using the real manifest counting rules — grapheme counting for Bluesky, weighted URL=23 and CJK=2 counting for X, and exact UTF-16 or grapheme limits across LinkedIn, Threads, Instagram, TikTok and YouTube.

POST/v2/posts/create367 / 300 characters

Unicode grapheme counting (Intl.Segmenter). up to 4 images, up to 1 video (one kind per part).

400 validation_failedLive response envelope
{
  "code": "validation_failed",
  "message": "Post failed 1 manifest check for Bluesky.",
  "remediation": {
    "hint": "Shorten part 1 by 67 characters.",
    "docs_url": "/docs/errors/#err-validation_failed"
  },
  "details": {
    "provider_id": "bluesky",
    "manifest_revision": 10,
    "counting": "grapheme",
    "measured": 367,
    "limit": 300,
    "errors": [
      {
        "rule_id": "text.max_length",
        "part_index": 0,
        "field": "text",
        "message": "Part 1 is 367 characters long; the limit is 300.",
        "remediation": "Shorten part 1 by 67 characters."
      }
    ]
  }
}

Bluesky: 400 validation_failed (367 of 300 characters). Shorten part 1 by 67 characters.

Complete error catalog#

Generated directly from packages/schemas/src/common/errors.ts and verified against drift in CI. Every code links from theREST v2 reference.

Showing all 41 error codes.

CodeHTTPStageRetryableWhen and remediation
capability_unknown404Stage 0no

The requested capability name or version is not in the frozen registry.

Details: None (no capability enumeration for unauthenticated callers).

Remediation: Check the capability path against the REST v2 reference.

capability_retired410Stage 0no

The capability version passed its sunset date.

Details: { retired_at, replacement? }

Remediation: Migrate to the replacement capability named in remediation.capability.

unauthenticated401Stage 1no

The Authorization Bearer token is missing, malformed, unknown or revoked.

Details: None.

Remediation: Supply a valid hlk_ API key, hlt_ OAuth token or session JWT in Authorization: Bearer.

principal_disabled403Stage 1no

The authenticated principal is suspended or revoked, or the membership was removed.

Details: { principal_id, status }

Remediation: Ask a workspace admin or operator to issue a new key or restore membership.

grant_expired403Stage 2no

The delegated Grant behind an agent token expired or was revoked.

Details: { grant_id, on_behalf_of, expired_at }

Remediation: Request a fresh delegation grant from the user.

scope_missing403Stage 3no

The principal's effective scopes do not include the capability's required scope.

Details: { required_scope, held_scopes }

Remediation: Use a principal that holds required_scope. Never expect approvals:decide on an agent key.

validation_failed400Stage 4no

Input JSON failed TypeBox schema validation or provider manifest content constraints.

Details: { errors: [{ path?, keyword?, rule_id?, channel_id?, part_index?, field?, message, remediation? }] }

Remediation: Fix every reported field or content constraint before retrying; never retry unchanged.

idempotency_key_required400Stage 4no

An Idempotency-Key header was omitted on a capability whose policy is required.

Details: { capability }

Remediation: Generate a unique Idempotency-Key (UUIDv7 recommended; 8 to 128 ASCII chars on posts.schedule) and retry.

payload_too_large413Stage 4no

The request body exceeded the transport limit (1 MiB for JSON capability calls).

Details: { limit_bytes, received_bytes }

Remediation: Reduce request size or upload large media through media.upload first.

idempotency_mismatch409Stage 5no

An Idempotency-Key was reused within 24 hours with a different canonical request payload.

Details: { key, original_request_hash, original_created_at }

Remediation: Mint a new Idempotency-Key for distinct payloads; reuse a key only when retrying the exact same intent.

idempotency_in_flight409Stage 5yes

Another request with the same Idempotency-Key is still executing.

Details: { key } plus retry_after (typically 5 seconds).

Remediation: Wait retry_after seconds and retry with the same Idempotency-Key to receive the canonical response.

entitlement_exceeded402Stage 6no

The workspace reached a plan limit (channels, seats, keys or monthly posts).

Details: { limit_type, limit, used, tier }

Remediation: Free unused resources or upgrade the workspace plan.

policy_forbidden403Stage 7no

An organisation-authored policy rule (such as quiet hours with effect deny) forbade the call.

Details: { rule_id, policy_scope, reason? }

Remediation: Adjust the target slot or ask an admin to review the workspace policy.

guardrail_forbidden403Stage 7no

A shipped platform guardrail or separation-of-duties rule forbade the action outright.

Details: { guardrail, platform, guardrail_version } or offending_renditions[].

Remediation: Cannot be bypassed by approval or policy; remove the offending channel or use an independent reviewer.

rate_limited429Stage 8yes

Per-principal or per-org request bucket is empty, or a channel daily cap filled in flight.

Details: { scope, class } plus retry_after (daily cap adds cap_type, limit, used, channel_id, day).

Remediation: Wait retry_after seconds before retrying. Respect the Retry-After response header.

not_found404Stage 9no

The referenced post, channel, approval request, media item or resource does not exist in this organisation.

Details: { resource_type, id }

Remediation: Verify the UUIDv7 id and organisation binding; cross-organisation ids also return not_found.

conflict_stale_version409Stage 9no

Optimistic-lock version did not match the current row version.

Details: { your_version, current_version, current }.

Remediation: Inspect details.current, merge your change onto current_version and retry (or use withRebase in the SDK).

channel_needs_reauth422Stage 9no

A target channel's stored platform credential expired or was revoked.

Details: { channel_id, provider_id } with remediation.capability.

Remediation: Reconnect the channel in the web app or via channels.connect_credentials / channels.connect_url.

platform_rejected422Stage 9no

The upstream social platform synchronously rejected the content or credentials.

Details: { channel_id?, provider_id, platform_code?, platform_message?, violated_constraint? }

Remediation: Fix the rejected content or credentials; inspect providers.capabilities for updated rules.

timeout504Stage 9yes

The capability exceeded its synchronous handler time budget.

Details: { timeout_ms }

Remediation: Retry with the same Idempotency-Key for act/irreversible calls after checking status.

token_expired401Stage 1no

The short-lived session JWT or hlt_ OAuth access token expired.

Details: { expired_at }

Remediation: Refresh the access token through /v2/auth/refresh or the OAuth token endpoint.

csrf_failed403identity planeno

A cookie-authenticated identity route lacked a matching Origin or X-Honeloop-Csrf: 1 header.

Details: None.

Remediation: Send requests from the application's own origin with X-Honeloop-Csrf: 1.

role_forbidden403identity planeno

The user's workspace role cannot perform this member, invitation or key action.

Details: { required_role, role }

Remediation: Ask a workspace owner or admin with sufficient role permissions to perform the action.

token_reused401Stage 1no

A rotated refresh token was presented again, revoking the session family.

Details: None.

Remediation: Sign in again; coordinate browser refreshes across tabs.

org_mismatch403Stage 1no

X-Honeloop-Org was empty or did not match the authenticated credential's organisation UUID.

Details: None.

Remediation: Omit X-Honeloop-Org or send the exact lowercase UUIDv7 of the credential's organisation.

credential_in_url400transportno

A credential-shaped token (hlk_, hlt_, hlr_, hlm_, hli_ or bare secret) appeared in the URL path or query.

Details: None.

Remediation: Send credentials only in the Authorization: Bearer header and rotate any leaked token immediately.

method_not_allowed405transportno

A non-POST HTTP method was sent to a capability route.

Details: None (Allow: POST header included).

Remediation: Send POST /v2/<domain>/<verb> with a JSON object body.

unsupported_media_type415transportno

Content-Type was missing or not application/json (or multipart/form-data on media.upload).

Details: None.

Remediation: Set Content-Type: application/json on capability calls.

credits_exhausted402Stage 6no

Metered credits or the workspace monthly X pay-per-use cap was reached.

Details: { credit_type, required, balance } (X cap adds cap_type, limit, used, period, unit).

Remediation: Raise max_x_spend_usd_per_month via policies.set or top up credits.

budget_exceeded402Stage 7no

A configured spend cap (such as the content agent monthly budget) was reached.

Details: { cap_type, limit, used }

Remediation: Wait for the next billing period or raise the cap via agent.update_settings / policies.set.

invalid_state409Stage 9no

The requested transition is not allowed from the entity's current lifecycle state.

Details: { state, allowed_transitions }

Remediation: Read current status; failed posts cannot return to scheduled or publishing.

cursor_invalid400Stage 9no

A pagination cursor was malformed, expired or paired with changed filter parameters.

Details: None.

Remediation: Restart pagination from the first page without a cursor parameter.

publish_in_progress409Stage 9no

A cancel or reschedule arrived after the publish workflow had already claimed the post.

Details: { post_id }

Remediation: Poll posts.status for the final publication outcome; it can no longer be cancelled.

publish_state_unknown409Stage 9no

A mutating publish call timed out, threw an untyped error or exhausted its pending wait.

Details: { post_id, rendition_id?, part_index? } with recreate: false.

Remediation: NEVER publish again automatically. Inspect the destination channel directly before taking any action.

published_with_error409Stage 9no

The post is live on the platform, but a follow-up step failed.

Details: { post_id, rendition_id, platform_post_id, url } with recreate: false.

Remediation: The post is already live. Do not publish again; complete any follow-up step manually.

channel_disabled422Stage 9no

The target channel was disconnected and its credentials were scrubbed.

Details: { channel_id }

Remediation: Reconnect the channel before targeting it in a new post.

platform_unavailable502Stage 9yes

The upstream platform was unavailable after typed Retryable attempts were exhausted.

Details: { provider_id } plus optional retry_after.

Remediation: Wait and retry; for a failed rendition with recreate: true, create a new post for that channel.

orchestrator_unavailable503Stage 9yes

Temporal could not start or signal the workflow; the claim was released.

Details: None plus retry_after.

Remediation: Wait retry_after seconds and retry with the same Idempotency-Key.

dependency_unavailable503anyyes

A backing dependency (Postgres, key management or storage) was temporarily unreachable.

Details: None plus retry_after.

Remediation: Wait retry_after seconds and retry with backoff.

internal_error500anyyes

An unexpected internal fault occurred; no internal details are leaked.

Details: { correlation_id } (also present in X-Correlation-Id header).

Remediation: Retry idempotently with backoff and quote X-Correlation-Id if contacting support.

CLI exit code map (hl)#

When stdout is not a terminal, hl emits one JSON document on stdout and maps machine error codes to stable exit statuses for scripts and coding agents.

Exit codeMeaning
0Success, including HTTP 202 approval_required diversions (use --fail-on-diversion to map diversions to exit 10).
1Unexpected or network failure after retries.
2CLI usage error (missing flag, invalid JSON input or client-side schema mismatch).
3validation_failed
4scope_missing
5rate_limited (after SDK retries were exhausted)
6conflict_stale_version (details.current carries the live resource)
7idempotency_mismatch
8channel_needs_reauth
9platform_rejected
10approval_required when --fail-on-diversion is set
11not_found
12credits_exhausted
13Authentication failure (401/403 such as unauthenticated or token_expired)
14publish_state_unknown (recreate: false — never publish again)
15published_with_error (recreate: false — post is already live)
16orchestrator_unavailable, dependency_unavailable or platform_unavailable
17invalid_state
18policy_forbidden or guardrail_forbidden
19idempotency_key_required or idempotency_in_flight