# Omen API reference (/omen/api)

> Every Omen gRPC message: ClientMessage, ServerMessage, subscriptions, filters, acks, provenance, conn_seq, Resume, lag policies, errors and enums.



Omen has one RPC on one service. Everything else is a message on that stream.

```proto
syntax = "proto3";
package arpc;

service aRPC {
  rpc Subscribe(stream ClientMessage) returns (stream ServerMessage);
}
```

|                        |                                                                                       |
| ---------------------- | ------------------------------------------------------------------------------------- |
| Proto                  | [`/proto/omen/arpc.proto`](/proto/omen/arpc.proto), no imports                        |
| gRPC path              | `/arpc.aRPC/Subscribe`                                                                |
| Shape                  | Bidirectional: you write `ClientMessage`s, the server streams `ServerMessage`s        |
| Streams per connection | One. A second `Subscribe` on the same connection fails with `FAILED_PRECONDITION` (9) |
| Request compression    | Identity only. gzip or zstd is refused with `UNIMPLEMENTED` (12)                      |
| Transport              | Plaintext HTTP/2, insecure credentials ([endpoints](/omen/regions))                   |

## Package name

The package is `arpc`, and it must stay `arpc`: the service path `/arpc.aRPC/Subscribe` depends on it. The legacy aRPC proto ([`/proto/arpc/legacy/service.proto`](/proto/arpc/legacy/service.proto)) is also `package arpc`, so the two collide. **Never compile both into one build.** If you run both during migration, generate them into separate modules, crates or packages.

The proto has no `go_package` option. In Go, map it on the `protoc` command line:

```bash
protoc -I proto/omen \
  --go_out=. --go_opt=module=<your/module/path> \
  --go_opt=Marpc.proto=<your/module/path>/gen \
  --go-grpc_out=. --go-grpc_opt=module=<your/module/path> \
  --go-grpc_opt=Marpc.proto=<your/module/path>/gen \
  arpc.proto
```

Generated names follow the service name `aRPC`: `NewARPCClient` in Go, `a_rpc_client::ARpcClient` in Rust (tonic), `arpc.aRPC` in `@grpc/grpc-js`.

## Stream lifecycle

1. Open the connection and send `Subscribe` within **5 seconds**.
2. Optionally send `Resume` as the **very first** message.
3. Optionally send `ConnectionConfig` to set the lag policy.
4. Send one `SubscriptionRequest` per subscription and wait for its `SubscribeAck`. Add, replace and remove subscriptions at any time after that.
5. Read `ServerMessage`s until the stream ends. Nothing survives the connection except what `Resume` replays.

There's no commitment parameter: every frame is pre-execution. Omen has no accounts, blocks, block metadata or execution results; for those use [Velox](/velox) or [Yellowstone gRPC](/solana-rpc/grpc).

## ClientMessage

```proto
message ClientMessage {
  oneof msg {
    Resume resume = 1;                // optional; when present, MUST be the first message
    SubscriptionRequest subscribe = 2; // add or replace a sub_id
    Unsubscribe unsubscribe = 3;
    Ping ping = 4;
    ConnectionConfig config = 5;
  }
}
```

| Arm           | Use                                                                        |
| ------------- | -------------------------------------------------------------------------- |
| `resume`      | Replay retained frames from a slot, then continue live. First message only |
| `subscribe`   | Add a subscription, or replace the one with the same `sub_id`              |
| `unsubscribe` | Remove a subscription by `sub_id`                                          |
| `ping`        | Ask for a `Pong` echoing your `id`                                         |
| `config`      | Set the connection-wide lag policy; may precede your subscriptions         |

### Resume

```proto
message Resume {
  uint64 from_slot = 1;
}
```

* Must be the **first** message on the stream. A `Resume` sent later is ignored.
* The server replays the frames it still retains from `from_slot` onward that match your subscriptions, each with `replayed = true`, then sends `ReplayComplete` and continues live.
* The replayed tail overlaps what you already received. De-duplicate transactions on `(slot, batch_index, entry_index, tx_index)`, which is stable across replay and reconnects.
* Retention is a short window: about two minutes at full-chain volume. A `from_slot` below it gets a `StreamError` with `ERROR_CODE_OUT_OF_RANGE`; the message names the oldest slot still retained. Reconnect without `Resume` (or from a newer slot) and backfill through [Solana RPC](/solana-rpc).
* Replays are capacity-limited. When none is available you get `ERROR_CODE_RESOURCE_EXHAUSTED` with `retry_after_ms` between 0.5 and 5 seconds; reconnect and resume after that.

### SubscriptionRequest

```proto
message SubscriptionRequest {
  uint32 sub_id = 1; // client-chosen, 0..63
  oneof kind {
    TransactionSubscription transactions = 2;
    EntrySubscription entries = 3;
    SlotSubscription slots = 4;
  }
  DataPolicy policy = 5;
}
```

`sub_id` rules:

* You choose it, from **0 to 63**. Above 63 is rejected with `ACK_REASON_INVALID_SUB_ID`.
* A request for a new `sub_id` adds a subscription; a request for one already in use **replaces** it. The other subscriptions are untouched.
* Every request gets exactly one `SubscribeAck` with its `sub_id`. A subscription delivers only after its accepted ack; limits are checked at ack time.
* If you send two requests for the same `sub_id` before the first is acked, the earlier one is acked `accepted = true` with `ACK_REASON_SUPERSEDED`. That's not an error: the later request is the one in force.
* The `sub_id`s that matched a frame come back as bits in `ServerMessage.matched_subs`.

### DataPolicy

```proto
message DataPolicy {
  bool exclude_recovered = 1;  // drop Reed-Solomon-recovered frames
  bool exclude_repaired = 2;   // drop turbine-repaired frames
  bool include_unverified = 3; // no effect
}
```

| Field                | Effect                                                                      |
| -------------------- | --------------------------------------------------------------------------- |
| `exclude_recovered`  | Skip frames whose data was rebuilt from erasure coding (`provenance` bit 1) |
| `exclude_repaired`   | Skip frames whose data arrived through repair (`provenance` bit 2)          |
| `include_unverified` | No effect: everything is verified before it's sent                          |

Leave the policy unset to receive everything.

### TransactionSubscription

```proto
message TransactionSubscription {
  repeated bytes account_include = 1;  // raw 32-byte keys
  repeated bytes account_exclude = 2;
  repeated bytes account_required = 3;
  bool exclude_votes = 4;
  TransactionEncoding encoding = 5;
  CuckooFilter cuckoo_account_include = 6;
}

enum TransactionEncoding {
  TRANSACTION_ENCODING_BINARY = 0;  // exact wire bytes (default)
  TRANSACTION_ENCODING_DECODED = 1; // parsed Transaction with LUT-resolved addresses
}
```

| Field                    | Rule                                                                                        |
| ------------------------ | ------------------------------------------------------------------------------------------- |
| `account_include`        | At least one listed key must be in the transaction                                          |
| `account_required`       | Every listed key must be in the transaction                                                 |
| `account_exclude`        | No listed key may be in the transaction                                                     |
| `exclude_votes`          | Drop vote transactions                                                                      |
| `encoding`               | `BINARY` sends `BinaryTransaction` (exact wire bytes); `DECODED` sends `DecodedTransaction` |
| `cuckoo_account_include` | A compact replacement for `account_include`; see [cuckoo filters](#cuckoofilter)            |

* Keys are **raw 32-byte values** (`bytes`), not base58 strings. Decode addresses before you send them. A key of any other length is rejected with `ACK_REASON_INVALID_FILTER`.
* Keys match against the transaction's static account keys **and** the addresses its lookup tables resolve to.
* The rules combine with AND.
* A transaction subscription with an empty `account_include` and no cuckoo filter is an unfiltered firehose, even if it sets `account_required` or `account_exclude`. Firehose capacity is limited: when it's full you get `ACK_REASON_FILTER_TOO_BROAD`.
* Key limits: 100,000 keys per subscription and 200,000 per connection ([limits](/omen/limits#filters-and-messages)).

### CuckooFilter

For very large key sets, send a cuckoo filter instead of listing every key. It replaces the `account_include` test with a membership probe: no false negatives, about one false positive in a million at 16-bit fingerprints. Drop the false positives on your side by checking the transaction's keys against your real set. `account_exclude`, `account_required`, `exclude_votes`, `encoding` and the `DataPolicy` still apply.

```proto
message CuckooFilter {
  bytes data = 1;
  uint32 bucket_count = 2;       // advisory only; derived from len(data)
  uint32 entries_per_bucket = 3; // 4, or 0 = unset (treated as 4)
  uint32 fingerprint_bits = 4;   // 16, or 0 = unset (treated as 16)
  uint64 hash_seed = 5;
  CuckooHashAlgorithm hash_algorithm = 6;
}

enum CuckooHashAlgorithm {
  CUCKOO_HASH_ALGORITHM_SIP_HASH_2_4 = 0; // the only supported algorithm
}
```

* Field numbers match Yellowstone's cuckoo filter message, but Omen supports **only 16-bit fingerprints, 4 entries per bucket and SipHash-2-4**.
* `data` is the bucket array over raw 32-byte keys. Each bucket is 8 bytes: four little-endian 16-bit fingerprint lanes, where 0 means an empty lane.
* The server derives the bucket count as `floor(len(data) / 8)`, which must be a non-zero power of two. Trailing bytes past the last whole bucket are ignored. `bucket_count` is advisory and never trusted.
* `hash_seed` is SipHash k0; k1 is `rotl64(hash_seed, 32)`. An absent `hash_seed` means **0**, not the common client default `0x796c6c7773746e21`: if your library uses that default, send it explicitly.
* Don't combine it with a non-empty `account_include`.
* `data` is at most 2 MiB; at most 4 cuckoo subscriptions per connection.

Where a cuckoo filter problem shows up:

| Problem                                                                              | You get                                                                                | Stream     |
| ------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------- | ---------- |
| Bad geometry, algorithm or bucket count, or combined with `account_include`          | `SubscribeAck`, `ACK_REASON_CUCKOO_FILTER_INVALID`                                     | Stays open |
| Already 4 cuckoo subscriptions on this connection, or no cuckoo filter capacity left | `SubscribeAck`, `ACK_REASON_CUCKOO_FILTER_LIMIT`; retry after an unsubscribe frees one | Stays open |
| Empty `data`, `data` above the size limit, or a wrong wire type on the field         | gRPC `INVALID_ARGUMENT` (3), no ack                                                    | Closed     |
| An oversized message that arrives when there's no capacity for it                    | gRPC `RESOURCE_EXHAUSTED` (8), retryable with backoff                                  | Closed     |

### EntrySubscription

```proto
message EntrySubscription {
  EntryMetadataFilter metadata = 1;
}

message EntryMetadataFilter {
  optional uint32 min_transaction_count = 1;
  optional uint32 max_transaction_count = 2;
  optional uint32 min_signature_count = 3;
  optional uint32 max_signature_count = 4;
  optional bool include_tick_entries = 5;
  optional bool include_non_tick_entries = 6;
}
```

Each set field narrows the entries you receive: transaction and signature count ranges, and whether tick-only and non-tick entries are included. Leave a field unset for no constraint.

### SlotSubscription

```proto
message SlotSubscription {
  bool include_dead = 1;
  bool include_complete = 2;
  bool include_first_shred = 3;
}
```

`SLOT_STATUS_ALIVE` is always sent. Each flag adds one more status: `DEAD`, `COMPLETE` or `FIRST_SHRED`.

### Unsubscribe, Ping, ConnectionConfig

```proto
message Unsubscribe {
  uint32 sub_id = 1; // the sub_id (0..63) to tear down
}

message Ping {
  uint64 id = 1; // echoed back in Pong for RTT measurement
}

message ConnectionConfig {
  OnLag on_lag = 1; // connection-wide lag policy; may precede subscribes
}

enum OnLag {
  ON_LAG_CLOSE = 0;        // close the stream with DATA_LOSS "lagged"
  ON_LAG_SKIP_TO_LIVE = 1; // jump to head and emit a GapNotice
  ON_LAG_CONFLATE = 2;     // slot-status subs keep the latest per slot; data subs behave as SKIP_TO_LIVE
}
```

| `OnLag`                  | When your reader falls too far behind                                                                              |
| ------------------------ | ------------------------------------------------------------------------------------------------------------------ |
| `ON_LAG_CLOSE` (default) | The stream closes with gRPC `DATA_LOSS` (15), message `lagged`. Reconnect with `Resume` to pick up what you missed |
| `ON_LAG_SKIP_TO_LIVE`    | The stream jumps to the live head and sends a `GapNotice` with the skipped `seq` range                             |
| `ON_LAG_CONFLATE`        | Slot-status subscriptions keep only the latest status per slot; data subscriptions behave as `SKIP_TO_LIVE`        |

`SKIP_TO_LIVE` and `CONFLATE` are opt-in and lose data by design; backfill what a `GapNotice` reports through Solana RPC if you need it.

## ServerMessage

```proto
message ServerMessage {
  uint64 matched_subs = 1;
  bool replayed = 16;
  fixed64 conn_seq = 17;

  fixed64 seq = 2;
  fixed64 created_at_ns = 3;
  uint32 provenance = 4;
  oneof payload {
    BinaryTransaction binary_transaction = 5;
    DecodedTransaction decoded_transaction = 6;
    Entry entry = 7;
    SlotStatusUpdate slot = 8;
    SlotRetract retract = 9;
    Pong pong = 10;
    SubscribeAck ack = 11;
    StreamError error = 12;
    Heartbeat heartbeat = 13;
    ReplayComplete replay_done = 14;
    GapNotice gap = 15;
  }
}
```

| Field           | Meaning                                                                                                              |
| --------------- | -------------------------------------------------------------------------------------------------------------------- |
| `matched_subs`  | Bitmask of your `sub_id`s that matched this frame: bit *n* is `sub_id` *n*                                           |
| `replayed`      | This frame was served from a `Resume` replay                                                                         |
| `conn_seq`      | Per-connection counter, +1 on **every** frame, control frames included. Gap-free                                     |
| `seq`           | Global frame id. A de-duplication key only: it has gaps on a filtered stream                                         |
| `created_at_ns` | Unix time in nanoseconds when the data in this frame was first received; control-only frames carry the server's time |
| `provenance`    | How the frame's data arrived; see [provenance](#provenance)                                                          |

### seq vs conn\_seq

|            | `conn_seq`                                                             | `seq`                                                               |
| ---------- | ---------------------------------------------------------------------- | ------------------------------------------------------------------- |
| Scope      | Your connection                                                        | The server's whole frame stream                                     |
| Gaps       | Never. A gap is a transport bug: reconnect with `Resume` and report it | Always, on a filtered stream: frames you didn't match are skipped   |
| Restarts   | On every new connection                                                | No                                                                  |
| Use it for | Detecting loss on the wire                                             | De-duplication; the range in `GapNotice`; `ReplayComplete.live_seq` |

For transactions, the position key `(slot, batch_index, entry_index, tx_index)` is the de-duplication key that stays stable across replay and reconnects.

### Provenance

| Bit  | Name          | Set when                                                                                              |
| ---- | ------------- | ----------------------------------------------------------------------------------------------------- |
| 0    | `PARTIAL_RUN` | The frame was sent as soon as its part of the batch arrived, before the whole batch had been received |
| 1    | `RECOVERED`   | The data was rebuilt with Reed-Solomon erasure coding                                                 |
| 2    | `REPAIRED`    | The data arrived through turbine repair                                                               |
| 3    | `UNVERIFIED`  | Never set: everything is verified before it's sent                                                    |
| 8–31 | —             | Reserved                                                                                              |

`DataPolicy` can filter out recovered and repaired frames per subscription.

### BinaryTransaction

```proto
message BinaryTransaction {
  uint64 slot = 1;
  uint32 batch_index = 2;
  uint32 entry_index = 3;
  uint32 tx_index = 4;
  bytes signature = 5;   // 64-byte primary signature (raw, no base58)
  bytes transaction = 6; // exact wire bytes of the transaction
}
```

Sent for subscriptions with `TRANSACTION_ENCODING_BINARY`. `transaction` is the exact serialized transaction; decode it with your Solana SDK. `slot`, `batch_index`, `entry_index` and `tx_index` locate it in the slot.

### DecodedTransaction

```proto
message DecodedTransaction {
  uint64 slot = 1;
  uint32 batch_index = 2;
  uint32 entry_index = 3;
  uint32 tx_index = 4;
  bytes signature = 5;
  Transaction transaction = 6;
  bool lut_miss = 7; // at least one LUT-referenced key was unresolved
}

message Transaction {
  repeated bytes signatures = 1;
  Message message = 2;
  bool is_vote = 3;
  bytes fee_payer = 4;
}

message Message {
  MessageHeader header = 1;
  repeated bytes account_keys = 2;
  bytes recent_blockhash = 3;
  repeated CompiledInstruction instructions = 4;
  repeated MessageAddressTableLookup address_table_lookups = 5;
  repeated bytes loaded_writable_addresses = 6; // LUT-resolved
  repeated bytes loaded_readonly_addresses = 7; // LUT-resolved
  TransactionVersion transaction_version = 8;
  TransactionConfig transaction_config = 9;     // present only for v1
}

message MessageHeader {
  uint32 num_required_signatures = 1;
  uint32 num_readonly_signed_accounts = 2;
  uint32 num_readonly_unsigned_accounts = 3;
}

message CompiledInstruction {
  uint32 program_id_index = 1;
  bytes accounts = 2;
  bytes data = 3;
}

message MessageAddressTableLookup {
  bytes account_key = 1;
  bytes writable_indexes = 2;
  bytes readonly_indexes = 3;
}

enum TransactionVersion {
  TRANSACTION_VERSION_LEGACY = 0;
  TRANSACTION_VERSION_V0 = 1;
  TRANSACTION_VERSION_V1 = 2;
}

// The mask preserves presence even when a configured scalar is zero.
message TransactionConfig {
  uint32 mask = 1;
  uint64 priority_fee = 2;
  uint32 compute_unit_limit = 3;
  uint32 loaded_accounts_data_size_limit = 4;
  uint32 heap_size = 5;
}
```

Sent for subscriptions with `TRANSACTION_ENCODING_DECODED`.

* All keys, signatures and hashes are raw bytes: 32-byte keys, 64-byte signatures.
* `loaded_writable_addresses` and `loaded_readonly_addresses` are the addresses the lookup tables resolve to. If any lookup couldn't be resolved, `lut_miss` is `true` and those lists are incomplete.
* `is_vote` and `fee_payer` are filled for you.
* `CompiledInstruction.accounts` is a byte string of account indexes, as on the wire.
* `transaction_config` is present only for `TRANSACTION_VERSION_V1` messages. `mask` tells you which of its fields were actually set, so a configured zero is distinguishable from an absent value.

### Entry

```proto
message Entry {
  uint64 slot = 1;
  uint32 batch_index = 2;
  uint32 entry_index = 3;
  bytes data = 4; // bincode entry bytes (exact leader-signed bytes)
  uint32 tx_count = 5;
  uint32 sig_count = 6;
  bool tick_only = 7;
  bool is_last_in_slot = 8;
}
```

`data` is the bincode-serialized entry exactly as the leader produced it. `tx_count` and `sig_count` let you skip entries without decoding them; `tick_only` marks tick entries; `is_last_in_slot` marks the slot's final entry.

### SlotStatusUpdate

```proto
message SlotStatusUpdate {
  uint64 slot = 1;
  SlotStatus status = 2;
  bytes leader = 3; // 32-byte leader pubkey; empty when unknown
}

enum SlotStatus {
  SLOT_STATUS_ALIVE = 0;
  SLOT_STATUS_FIRST_SHRED = 1;
  SLOT_STATUS_COMPLETE = 2;
  SLOT_STATUS_DEAD = 3;
  reserved 8, 9; // reserved for consensus statuses; this version is pre-consensus only
}
```

| Status        | Meaning                                                                    | Sent                       |
| ------------- | -------------------------------------------------------------------------- | -------------------------- |
| `ALIVE`       | The slot is live; sent before its first data frame                         | Always                     |
| `FIRST_SHRED` | The slot's first shred was observed                                        | With `include_first_shred` |
| `COMPLETE`    | The slot's last entry was observed. **Not** confirmed, rooted or finalized | With `include_complete`    |
| `DEAD`        | The slot was abandoned                                                     | With `include_dead`        |

Values 8 and 9 are reserved for future consensus statuses. A slot that was retracted and then receives data again is announced with a new `ALIVE`.

### SlotRetract

```proto
message SlotRetract {
  uint64 slot = 1;
  RetractReason reason = 2;
}

enum RetractReason {
  RETRACT_REASON_UNSPECIFIED = 0;
  RETRACT_REASON_DEAD = 1;
  RETRACT_REASON_EQUIVOCATION = 2;
  RETRACT_REASON_VERIFY_FAILED = 3;
}
```

Discard everything previously delivered for `slot`.

| Reason                         | Meaning                                                                            |
| ------------------------------ | ---------------------------------------------------------------------------------- |
| `RETRACT_REASON_DEAD`          | The slot was declared dead                                                         |
| `RETRACT_REASON_EQUIVOCATION`  | The leader produced a conflicting version of this slot, and the delivered one lost |
| `RETRACT_REASON_VERIFY_FAILED` | Leader signature verification failed                                               |

### Pong

```proto
message Pong {
  uint64 id = 1; // echoes Ping.id
}
```

### SubscribeAck

```proto
message SubscribeAck {
  uint32 sub_id = 1;
  bool accepted = 2;
  AckReason reason = 3;
}

enum AckReason {
  ACK_REASON_NONE = 0;
  ACK_REASON_INVALID_SUB_ID = 1;
  ACK_REASON_INVALID_FILTER = 2;
  ACK_REASON_MAX_KEYS_PER_SUB = 3;
  ACK_REASON_MAX_KEYS_PER_CONN = 4;
  ACK_REASON_MAX_SUBS_PER_CONN = 5;
  ACK_REASON_FILTER_TOO_LARGE = 6;
  ACK_REASON_FILTER_TOO_BROAD = 7;
  reserved 8;
  ACK_REASON_CUCKOO_FILTER_INVALID = 9;
  ACK_REASON_CUCKOO_FILTER_LIMIT = 10;
  ACK_REASON_SERVER_RESOURCES = 11;
  ACK_REASON_SUPERSEDED = 12;
}
```

A rejection (`accepted = false`) affects only that `sub_id`; the stream and your other subscriptions keep running.

| Reason                             | `accepted` | Meaning                                                                              | What to do                                            |
| ---------------------------------- | ---------- | ------------------------------------------------------------------------------------ | ----------------------------------------------------- |
| `ACK_REASON_NONE`                  | `true`     | Accepted, no further detail                                                          | —                                                     |
| `ACK_REASON_SUPERSEDED`            | `true`     | A later request for this `sub_id` replaced this one                                  | Nothing; not an error                                 |
| `ACK_REASON_INVALID_SUB_ID`        | `false`    | `sub_id` above 63, or that `sub_id` is still being removed                           | Use 0–63; retry a `sub_id` that is being removed      |
| `ACK_REASON_INVALID_FILTER`        | `false`    | Malformed filter, e.g. a key that isn't 32 bytes                                     | Fix the filter                                        |
| `ACK_REASON_MAX_KEYS_PER_SUB`      | `false`    | More than 100,000 keys in this subscription                                          | Split it, or use a cuckoo filter                      |
| `ACK_REASON_MAX_KEYS_PER_CONN`     | `false`    | More than 200,000 keys across the connection                                         | Open another connection                               |
| `ACK_REASON_MAX_SUBS_PER_CONN`     | `false`    | No free subscription slot, on this connection or on the server                       | Unsubscribe one, or retry with backoff                |
| `ACK_REASON_FILTER_TOO_LARGE`      | `false`    | The filter is too large for the server to accept right now                           | Shrink it, or retry with backoff                      |
| `ACK_REASON_FILTER_TOO_BROAD`      | `false`    | Unfiltered firehose refused: firehose capacity is full                               | Add filters, or retry later with backoff              |
| `ACK_REASON_CUCKOO_FILTER_INVALID` | `false`    | Bad cuckoo geometry, algorithm or bucket count, or combined with `account_include`   | Fix the filter                                        |
| `ACK_REASON_CUCKOO_FILTER_LIMIT`   | `false`    | Already 4 cuckoo subscriptions on this connection, or no cuckoo filter capacity left | Retry after an unsubscribe frees one, or with backoff |
| `ACK_REASON_SERVER_RESOURCES`      | `false`    | Transient server capacity limit, not filter size                                     | Retry with backoff                                    |

Value 8 is retired and never reused. A refusal caused by server capacity (always for `FILTER_TOO_LARGE`, `FILTER_TOO_BROAD` and `SERVER_RESOURCES`; sometimes for `MAX_SUBS_PER_CONN` and `CUCKOO_FILTER_LIMIT`) is preceded by a `StreamError` with `ERROR_CODE_RESOURCE_EXHAUSTED` and a `retry_after_ms` hint of 0.5–5 seconds.

### StreamError

```proto
message StreamError {
  ErrorCode code = 1;
  string message = 2;
  uint32 retry_after_ms = 3; // 0 = no retry hint
}

enum ErrorCode {
  ERROR_CODE_UNSPECIFIED = 0;
  ERROR_CODE_UNKNOWN = 1;
  ERROR_CODE_INVALID_FILTER = 2;
  ERROR_CODE_FILTER_TOO_COMPLEX = 3;
  ERROR_CODE_RATE_LIMITED = 4;
  ERROR_CODE_QUOTA_EXCEEDED = 5;
  ERROR_CODE_INTERNAL = 6;
  ERROR_CODE_UNAVAILABLE = 7;
  ERROR_CODE_SHUTTING_DOWN = 8;
  ERROR_CODE_FLOW_CONTROL_LIMITED = 9;
  ERROR_CODE_RESOURCE_EXHAUSTED = 10;
  ERROR_CODE_OUT_OF_RANGE = 11;
}
```

An in-band error. Wait at least `retry_after_ms` (when non-zero) before you reconnect or retry.

| Code                                                                                                                                     | Meaning                                                                                       | What to do                                                                         |
| ---------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
| `ERROR_CODE_SHUTTING_DOWN`                                                                                                               | The server is shutting down; carries a jittered `retry_after_ms`                              | Reconnect after the hint, with `Resume`                                            |
| `ERROR_CODE_FLOW_CONTROL_LIMITED`                                                                                                        | Advisory: your HTTP/2 receive window is persistently too small for the stream                 | Raise the window ([flow control](/omen/limits#flow-control)); the stream continues |
| `ERROR_CODE_RESOURCE_EXHAUSTED`                                                                                                          | A replay or a broad subscription was refused for capacity; carries `retry_after_ms` (0.5–5 s) | Retry after the hint                                                               |
| `ERROR_CODE_OUT_OF_RANGE`                                                                                                                | The `Resume` slot is older than retention                                                     | Reconnect without `Resume` and backfill through Solana RPC                         |
| `ERROR_CODE_UNSPECIFIED`, `UNKNOWN`, `INVALID_FILTER`, `FILTER_TOO_COMPLEX`, `RATE_LIMITED`, `QUOTA_EXCEEDED`, `INTERNAL`, `UNAVAILABLE` | Defined for completeness; you shouldn't normally see them                                     | Reconnect with backoff                                                             |

### Heartbeat

```proto
message Heartbeat {
  uint64 slot = 1;
}
```

Sent after 10 seconds without any other frame. `slot` is the newest slot observed, so an idle subscription still sees the chain advance.

### ReplayComplete

```proto
message ReplayComplete {
  fixed64 live_seq = 1; // head frame id at the moment the stream joined live
}
```

Sent once a `Resume` replay has caught up. Frames after it are live.

### GapNotice

```proto
message GapNotice {
  fixed64 from_seq = 1; // last seq delivered before the gap
  fixed64 to_seq = 2;   // first seq delivered after the jump to live
}
```

Sent only under `ON_LAG_SKIP_TO_LIVE` or `ON_LAG_CONFLATE`, when the stream skipped frames to catch up. `conn_seq` stays gap-free across it; the skipped data is identified by `seq`.

<Callout type="warn" title="Pre-execution data">
  Nothing on this stream has executed. `SLOT_STATUS_COMPLETE` means the slot's last entry was observed, not that it's confirmed. Confirm anything irreversible through [Solana RPC](/solana-rpc).
</Callout>
