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

# Failure handling

> What the guard does when it cannot get a verdict.

Detection needs the network, so the failure path is part of the contract.

## `onScanError`

| Value | When the control plane is unreachable, times out, returns a non-2xx status, or returns a verdict that fails validation |
| - | - |
| `block` (default) | The request is refused with `reason: "scan_unavailable"`. |
| `allow` | The request is forwarded uninspected. The telemetry record still shows the decision. |

```ts theme={null}
const fw = new FrostWolfClient({ apiKey, onScanError: "allow" });
```

A malformed verdict is treated exactly like an unreachable control plane. Coercing a partly understood response into an allow would turn a block into a silent pass.

The refusal carries `severity: "high"` and a reason that is deliberately not a rule id, so an operator reading a log can tell a detection from an outage. One is a payload to investigate. The other is a dependency to restore.

<Warning>
  Failing open means a control-plane outage disables the guard. Choose it only if availability matters more than enforcement.
</Warning>

## Reporting never blocks

Telemetry and capture are fire-and-forget. A reporting failure goes to your `onError` callback and is never raised into the request path. The queues are bounded, so a stalled network cannot grow memory.

```ts theme={null}
const fw = new FrostWolfClient({
  apiKey,
  onError: (error) => logger.warn({ error }, "frostwolf background failure"),
});
```

## The semantic pass

The semantic classifier fails open, because it runs behind a static pass that already found nothing. See [Detection](/guard/detection).

## Cloak

[Cloak](/cloak/with-attack-check) fails closed on its own account, whatever `onScanError` says. A request it could not check for personal data is refused with `reason: "cloak_unavailable"`.

## Shutdown

Flush on shutdown so the last batch is not lost.

<CodeGroup>
  ```ts TypeScript theme={null}
  await fw.close();
  ```

  ```python Python theme={null}
  fw.close()
  ```
</CodeGroup>


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