> For the complete documentation index, see [llms.txt](https://docs.antivamp.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.antivamp.io/partners/04_failure_modes.md).

# Failure Modes

**The rule: fail closed. If you cannot obtain a fresh, valid, signed `allow`, do not launch.**

## Decision values (production principle)

| decision                | when                                                | launchpad action                       |
| ----------------------- | --------------------------------------------------- | -------------------------------------- |
| `allow`                 | verified available identity                         | proceed                                |
| `allow_authorized_only` | protected identity, correct wallet                  | proceed only for the authorized wallet |
| `block`                 | protected identity, wrong wallet                    | reject                                 |
| `recheck_required`      | stale/incomplete/conflicting data                   | do not launch; re-validate             |
| `service_unavailable`   | critical failure or production paused for the chain | do not launch                          |

`service_unavailable` is returned as HTTP 503 (also surfaced as a decision on paused chains). The SDK converts it to `AntiVampFailClosedError`. Undocumented fail-open behavior is never the default.

| Situation                   | API behavior                                 | Your required action                        |
| --------------------------- | -------------------------------------------- | ------------------------------------------- |
| Backend unconfigured        | 503 `service_unavailable`                    | Do not launch                               |
| Timeout / network error     | SDK throws `AntiVampFailClosedError`         | Do not launch; retry                        |
| 5xx / 429 (transient)       | SDK retries w/ backoff, then throws          | Do not launch on final failure              |
| `recheck_required` decision | 200, `decision:"recheck_required"`           | Do not launch; re-validate                  |
| Signature invalid           | `verifyValidationDecision` → `{valid:false}` | Reject the decision                         |
| Decision expired            | verification `reason:"expired"`              | Re-validate; never use stale allow          |
| Oracle stale (reserve)      | on-chain revert `StaleOracle`                | Reservation paused until refreshed          |
| Rate limited                | 429 `rate_limited`                           | Back off (SDK does this)                    |
| Invalid API key             | 401 `invalid_api_key`                        | Fix credentials — not fail-closed-retryable |

## Client-error vs fail-closed

4xx client errors (bad request, invalid key, `production_reporting_restricted`) are **your** bug — the SDK surfaces them as `AntiVampApiError`, not `AntiVampFailClosedError`. Fix and retry deliberately. Only outages/timeouts/5xx become fail-closed.

## Decision lifetime

Decisions expire 5 minutes after issue. If your deploy pipeline can take longer between validation and on-chain deployment, re-validate immediately before the deploy transaction. Do not cache an `allow` beyond its `expiresAt`.

## Idempotent retries

Retrying a validation or report with the same `Idempotency-Key`/`nonce` is safe — it returns the original response, never a divergent one.

## Structured errors

All partner errors: `{ "error": { "code", "message", "details?" } }`. Switch on `code`, not the human message.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.antivamp.io/partners/04_failure_modes.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
