Skip to content

docs: add an error reference for every widget-visible error - #59

Draft
HughParry wants to merge 1 commit into
mainfrom
docs/error-reference
Draft

docs: add an error reference for every widget-visible error#59
HughParry wants to merge 1 commit into
mainfrom
docs/error-reference

Conversation

@HughParry

Copy link
Copy Markdown

Closes prosopo/captcha-private#1350.

Adds basics/error-reference, documenting every error message Procaptcha can display in place of the widget. Each entry gives the translated string, the stable translation key, the HTTP status, then What it means / What causes it / How to fix it.

The page

Opens with how to read an error — the on-screen string is translated per visitor, API.SITE_KEY_NOT_REGISTERED never is — and how to pull the key out of the Network tab. That last bit is necessary because error-callback receives only the translated message, not the key.

Then a quick-reference table linking into four groups:

Group Errors
Configuration API.SITE_KEY_NOT_REGISTERED, API.INVALID_SITE_KEY, API.UNAUTHORIZED_ORIGIN_URL, API.INCORRECT_CAPTCHA_TYPE, WIDGET.INSECURE_CONTEXT
Transient CAPTCHA.NO_SESSION_FOUND, Cannot load CAPTCHA
Blocked visitors Frictionless response missing captchaType… (401), Forbidden: <request id> (403)
Unexpected CAPTCHA.PARSE_ERROR, API.BAD_REQUEST

Plus a table of console-only failures (No site key found, GENERAL.SITE_KEY_MISSING, DEVELOPER.PROVIDER_NO_CAPTCHA), since "the captcha just doesn't appear and there's no error" is a distinct support case.

Scope: what reaches the screen

The list is derived from the render path — state.error.message into Checkbox, and fallOverWithStyle for frictionless — not from the locale file, which is far broader. That excludes more than it includes:

  • Errors thrown inside providerRetry go to console.error and never render.
  • PoW/puzzle submit returns { status: "ok", verified: false } with no message.
  • IP-category block reasons (VPN_BLOCKED, TOR_BLOCKED, DATACENTER_BLOCKED, …) are deferred to submit/verify time by design, so a blocked visitor still gets a captcha. They belong with the siteverify ResultReason values, not here.
  • API.FAILED_IP_VALIDATION is unreachable at challenge time — validateSessionIP unconditionally returns { valid: true }.

Access-policy blocks and auto-ban both emit a bare 401 {error: "Unauthorized"}, which the widget's guard turns into the developer-ish Frictionless response missing captchaType; halting captcha mount. Documented as-is, because that is genuinely what a blocked visitor sees.

FAQ

The six error Q&As now give a one-line answer and link into the detailed section, so the prose lives in one place. Also corrects Session not foundNo session found (the actual string) and adds an entry for the silent-console-failure case.

Follow-ups, not in this PR

  • data-captcha-type is documented but ignored. renderLogic.test.tsx asserts the bundle silently ignores it — the type is server-driven now — but basics/captcha-types.mdx still tells people to set it. The Incorrect CAPTCHA type section here is written around the real causes instead; that page needs its own fix.
  • Three keys have no translation entry. API.INTERNAL_SERVER_ERROR, API.UNKNOWN_ERROR and CAPTCHA.DECISION_MACHINE_DENIED are referenced in code but absent from locale/src/locales/en/translation.json, so i18next would render the raw key. None are on a widget-visible path today, so they are not documented here, but they are latent.

Verification

  • npm run build passes — 396 pages; the page builds for all locales via English fallback.
  • npm run lint:linkcheck:nobuild reports no link issues; all 11 quick-reference anchors and the FAQ deep-links resolve against generated heading ids.

⚠️ npm run lint fails on main already, independently of this change: 2 eslint errors in scripts/lib/linkcheck/base/page.ts and src/components/starlight/Head.astro. CI will be red until those are fixed separately. lint:slugcheck likewise fails on 5 pre-existing stale basics/context-awareness.mdx translations (the English page lives at advanced/ now).

https://claude.ai/code/session_01DLYQU7po3wAWsppeaUrU7b

Documents each error message Procaptcha can display in place of the
widget, with the translated string, the stable translation key, the HTTP
status, and — for each — what it means, what causes it, and how to clear
it.

The set is derived from what actually reaches the screen (state.error.message
into Checkbox, and fallOverWithStyle for frictionless) rather than from the
locale file, which is much broader. Errors thrown inside providerRetry go to
console.error and never render, and PoW/puzzle submit returns
{ status: "ok", verified: false } with no message, so the IP-category block
reasons (VPN_BLOCKED, TOR_BLOCKED, ...) are deliberately excluded — they are
deferred to submit/verify time and belong with the siteverify ResultReason
values. API.FAILED_IP_VALIDATION is likewise omitted: validateSessionIP
unconditionally returns valid.

The six error Q&As in the FAQ now give a one-line answer and link into the
detailed section so the prose lives in one place. Corrects "Session not
found" to "No session found" (the actual string) and adds an entry for the
case where the widget fails silently to the console.

Incorrect CAPTCHA type is written around its real causes (direct API
integrations, old bundles, stale sessions, captchaType-pinning access rules)
rather than the data-captcha-type advice in captcha-types.mdx, which current
bundles ignore. That page needs a separate fix.

Claude-Session: https://claude.ai/code/session_01DLYQU7po3wAWsppeaUrU7b
@netlify

netlify Bot commented Aug 25, 2026

Copy link
Copy Markdown

Deploy Preview for peaceful-pothos-9e62ce ready!

Name Link
🔨 Latest commit c8a1548
🔍 Latest deploy log https://app.netlify.com/projects/peaceful-pothos-9e62ce/deploys/6a8d486abdb19400081263c5
😎 Deploy Preview https://deploy-preview-59--peaceful-pothos-9e62ce.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

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.

1 participant