> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lumenwipe.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Provider outage

> What the API does when an RPC or Horizon-compatible provider fails or rate limits, and when and how to change the provider list.

Each network reads through an ordered list of RPC URLs (`STELLAR_RPC_<NET>`) and of Horizon-compatible URLs (`PATH_ROUTING_API_<NET>`). The full rules are in [Provider failover](https://docs.lumenwipe.com/architecture.md#provider-failover); the parts that matter during an outage:

* A provider that answers `429`, a `5xx`, or a `200` with no JSON-RPC envelope (an empty or cut-off body) ends that request with `503 service_unavailable` and `Retry-After: 30`, and cools down for 70 seconds (`RPC_PROVIDER_COOLDOWN_MS`, the `Retry-After` plus the 40-second request deadline). The client's retry pins the next provider. A cooling provider is still tried when every other one fails.
* A timeout is a `503` too, but starts no cooldown, so a provider that hangs keeps being probed first. That is the case to act on by hand.
* A provider outage becomes a retryable `503`, never a wrong answer about an account, and a send never goes to a second provider.

## Blast radius

* **One provider down, list of two or more**: some requests get a `503` and succeed on retry. No action is needed unless it lasts.
* **Every provider down, or a single provider**: every read on that network fails with `503`. Closes cannot be planned or built. Nothing is lost: a close in progress resumes once reads come back ([Recovery](https://docs.lumenwipe.com/guides/recovery.md#the-service-is-unavailable)).
* **Only DeFi detection or token quotes down** (OctoPos, Soroswap, xBull): those have one provider each. Closes still run; position detection falls back to a classic-only close and token conversion is unavailable.
* **API deploys**: an RPC outage that the serving revision shares does not stop a deploy. The smoke test records `/health/deep` as `upstream` and the run warns; see [Bad deploy](https://docs.lumenwipe.com/runbooks/bad-deploy.md#an-upstream-smoke-result) for the check once the provider recovers.

## Steps

1. **Find which provider fails**:

   ```bash theme={null}
   curl -s "$API/health/dependencies" | jq '.dependencies[] | {upstream, network, state, lastErrorClass, lastSuccessAt}'
   ```

   Expected while healthy: `"state": "up"` everywhere. During an outage, the failing upstream shows `degraded` (some providers failing) or `down` (all), with `lastErrorClass` such as `rate_limited`, `unavailable`, `timeout` or `bad_response`. Probe results are cached for one minute (five for `paths` and `defi`). Check the provider's own status page.

2. **Rate limiting or short errors**: wait. The cooldown already routes around it, and the outage shows as `degraded`, not `down`.

3. **A provider that times out or stays down for more than 15 minutes**: take it out of the list, keeping the order of the rest. The value contains commas, so use the delimiter syntax:

   ```bash theme={null}
   gcloud run services describe lumenwipe-api --region us-central1 --format='yaml(spec.template.spec.containers[0].env)' | grep -A1 'STELLAR_RPC_<NET>'
   gcloud run services update lumenwipe-api --region us-central1 --update-env-vars='^@^STELLAR_RPC_<NET>=<remaining url>,<other url>'
   ```

   Each URL keeps its own auth header by position: if you remove the first URL, move its `_2` header variables to the unsuffixed names in the same command. A list is checked at boot (https, no duplicates); a bad one refuses to start, and the previous revision keeps serving. Expected: `Done.` and the new revision serving.

4. **Every provider down**: add a working public provider to the list in the same way, or wait for the provider. If it lasts, post the public update from [Incident response](https://docs.lumenwipe.com/runbooks/incident-response.md#public-update-template).

5. **When the provider recovers**, restore the original list with the same command.

## Confirm the fix

```bash theme={null}
curl -s "$API/health/dependencies" | jq '.dependencies[] | select(.network=="<net>") | {upstream, state}'
curl -s -o /dev/null -w '%{http_code}\n' "$API/health/deep"
```

Expected: `"state": "up"` for `rpc`, `horizon` and `paths`, and `200` from `/health/deep`. Then plan a testnet close on the site: it loads without a `503`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.