Approval errors
Every error code the approvals binding can answer with, what it means, and how to fix it.
When a call to the approvals binding is refused, you get an error with a code you can test for. The body looks like this:
{ "error": { "code": "approval_rate_limited", "message": "…", "how_to_fix": "…" } }
message says what happened. how_to_fix says what to do. In the SDK the call throws a PlatformError with .status, .code, .message, .howToFix and .requestId.
import { PlatformError } from '@cohostly/sdk' try { const approval = await platform.approvals.request({ summary: 'Delete 12 rows from orders' }) } catch (e) { if (e instanceof PlatformError && e.code === 'approval_rate_limited') return res.status(429).send('Too many asks. Try again in a minute.') throw e }
from platform_gen import platform, PlatformError try: approval = platform.approvals.request({"summary": "Delete 12 rows from orders"}) except PlatformError as e: if e.code == "approval_rate_limited": return {"error": "Too many asks. Try again in a minute."} raise
Errors from the binding
invalid_request400details is not an object, risk is not low, medium or high, action does not match the allowed pattern, or expires_in is not a whole number from 60 to 604800. Fix: correct the field named in the message.details_too_large400details is over 16 KiB. Fix: send only what the approver needs, and refer to big data by name or id.callback_path_not_registered400callback_path that differs from the manifest value, or none is registered. Fix: set bindings.approvals.callback_path, deploy, and leave callback_path out of the request.invalid_token401X-Platform-Binding-Token header. It is the PLATFORM_TOKEN setting, and on the platform it is added for you.binding_not_declared403bindings.approvals to cohostly.json and deploy.approval_blocked403not_found404idempotency_conflict409not_pending409get.approval_rate_limited429too_many_pending429rate_limited429retry-after header.not_implemented501Errors that only the SDK makes
These come from your own process, not from the platform. They have no HTTP status.
wait_timeoutstatus 0wait ran out of time. The approval is still pending. Fix: wait again with the id, or use a callback.abortedlocalAbortSignal you passed fired. Fix: call wait again if you still need the answer.network_errorlocalcohostly dev.not_configuredlocalPLATFORM_TOKEN, so the app is not on the platform. Fix: run on the platform, or with cohostly dev.What your callback route can answer
When the platform calls your callback_path, the SDK handler answers with these. The platform retries every answer that is not a 2xx. See callbacks and waiting.
405POST.401403400id, status or details_hash.503500Refusals people see
When a person answers in the dashboard or the CLI, a refusal uses one of these words. They are not codes your app receives.
not_foundnot_pendingexpirednot_eligiblealready_decidedhash_mismatchsupersededown_requestseparation_of_dutiessignin_requiredused, expired_linkunknownUp next · BindingsClock (cron)Run work at set times, even while your app is asleep. The platform keeps the clock, wakes your app, and records every run.Keep reading
← Back to Limits