services
Get a key

library / How to use Solana / Yellowstone gRPC / HS0069

gRPC max message size fix

Turn the length in a gRPC size error into four bytes and read what they say. A text reply, a real oversize message and a damaged stream each get a different fix, and a short script tells you which one you have.

By Carbium · Yellowstone gRPC · HS0069 · updated 2026-11-22

01

How the frame length is read

Every gRPC message travels in a frame with a five byte header. The first byte is the compression flag. The next four bytes are the length of the body, written as a big-endian unsigned integer. A client reads those five bytes before anything else, compares the length with its receive limit and throws Received message larger than max (N vs LIMIT) when N is bigger.

N is whatever four bytes the client found after the flag. On a healthy stream they are a length the server wrote. On a connection that carries something else, they are four bytes of that something else, and the client cannot tell the difference. It reports them as a size, so the error looks like a message that is far too large.

In your error the limit is 67108864, which is 64 MiB, and N is 1970303084, about 1.8 GiB. A single update on a Solana stream does not come near that. When a number sits that far past any plausible payload, check whether it is a size at all before you touch the limit.

02

Decoding the number

Write 1970303084 in hex and you get 0x7570706C. The four bytes are 75, 70, 70 and 6C, which are the ASCII letters u, p, p and l. A length that spells letters is text that was read as a header.

The error does not show the flag byte that sits just before those four. The text on the wire therefore began with one character and went on with uppl. That is enough to know a text reply arrived where gRPC frames were expected. It does not name the sender, so look at what sits between your machine and the port: a proxy, a gateway or a wrong host.

You can check any number by hand in Node. Create Buffer.alloc(4), call writeUInt32BE(n) on it and print the buffer with toString("latin1"). Letters and punctuation mean text. Control characters and bytes above 0x7E mean the number is not text.

$Four printable ASCII bytes always give a number above 538 million, because the smallest printable byte is 0x20. That is about 514 MiB. A legitimate message that large would need a receive limit of the same size or more, so with a 64 MiB limit, letters are the likelier reading.
03

Three verdicts

VerdictRule in the codeExample received value
Text replyAll four bytes are printable ASCII, 32 to 1261970303084, bytes 75 70 70 6c, text uppl
Plausible oversizeNot all printable, and received is at most 4 times the limit100000000 with a limit of 67108864, bytes 05 f5 e1 00
Damaged streamNot all printable, and received is more than 4 times the limit4294967295, bytes ff ff ff ff

Printable bytes are checked first because a text reply is the clearest signal. The cutoff of four times the limit for the other two cases is a working rule. A stream that passes a 64 MiB limit by a small factor is usually carrying a real, large payload, such as a subscription that includes whole blocks. A length many times past the limit with unprintable bytes is far more likely corruption.

04

The code

main.ts
// HS0069 · gRPC max message size fix// https://carbium.sh/library/howsolana/grpc-max-message-size-fix// Copyright (c) Carbium Corporation. MIT License (LICENSE). Keep this notice.// SPDX-License-Identifier: MIT// Decode the length in "Received message larger than max (N vs LIMIT)".const received = Number(process.argv[2] ?? 1970303084);const limit = Number(process.argv[3] ?? 67108864);if (!Number.isInteger(received) || received < 0 || received > 0xffffffff || !Number.isInteger(limit) || limit < 1) {  console.error("Usage: node main.ts [received] [limit], whole numbers, received below 2^32.");  process.exit(1);}const header = Buffer.alloc(4);header.writeUInt32BE(received);const prefix = [...header];const printable = prefix.every((b) => b >= 32 && b < 127);const shown = prefix.map((b) => (b >= 32 && b < 127 ? String.fromCharCode(b) : ".")).join("");console.log(`length ${received} = bytes ${header.toString("hex")} = text "${shown}"`);console.log(`ratio to limit: ${(received / limit).toFixed(2)}`);if (printable) {  console.log("verdict: text reply. Something answered in plain text; check the URL, port, TLS and any proxy.");} else if (received <= 4 * limit) {  console.log("verdict: plausible oversize. Raise the receive limit or narrow the subscription.");} else {  console.log("verdict: damaged stream. Check proxies, TLS and connection reuse.");}// Sizing anchor: how many bytes one finalized block takes as a JSON reply.const key = process.env.CARBIUM_KEY;if (!key) {  console.error("Set CARBIUM_KEY to your Carbium API key to measure a block.");  process.exit(1);}const url = process.env.CARBIUM_RPC_URL ?? "https://services.carbium.sh";const headers = { "content-type": "application/json", "x-api-key": key };async function call(method: string, params: unknown[]) {  const res = await fetch(url, {    method: "POST",    headers,    body: JSON.stringify({ jsonrpc: "2.0", id: 1, method, params }),  });  const bytes = new Uint8Array(await res.arrayBuffer());  const json = JSON.parse(new TextDecoder().decode(bytes)) as { result?: unknown; error?: { message: string } };  return { size: bytes.length, json };}try {  const slot = (await call("getSlot", [{ commitment: "finalized" }])).json.result as number;  for (let i = 0; i < 5; i++) {    const cfg = { commitment: "finalized", maxSupportedTransactionVersion: 1, rewards: false };    const block = await call("getBlock", [slot - i, cfg]);    if (block.json.result) {      console.log(`block ${slot - i}: reply ${block.size} bytes, ${(block.size / limit).toFixed(3)} of the limit`);      break;    }    console.log(`slot ${slot - i}: no block (${block.json.error?.message ?? "empty result"})`);  }} catch (e) {  console.log(`block measurement failed: ${e instanceof Error ? e.message : String(e)}`);}

run: node main.ts 1970303084 67108864

Run it with no arguments to decode the number from the error against its 64 MiB limit, or pass your own received and limit values. The decode needs no key and prints first. The second half sends one getBlock call for a finalized block to the RPC URL, with the key in the x-api-key header, and prints the size of the reply in bytes so you can set a block next to your limit. A slot that held no block answers with an error, so the script steps back up to five slots.

05

Fixing each case

  • Text reply: confirm the client opens the gRPC stream at https://services.carbium.sh:9443 over TLS. The RPC URL speaks JSON-RPC over HTTPS, so a gRPC client aimed at it can end up reading JSON or an HTTP error body as frames. Then look for an HTTP proxy, a VPN or a filtering gateway on the path, and take it out or give it a route that carries gRPC. Send the key in the x-token header and check that the account is on Dev, Business or Pro.
  • Plausible oversize: raise the receive limit in the channel options of your client (grpc.max_receive_message_length in grpc-js) to the largest message you measured plus headroom, and adjust filters on a live stream so the subscription asks for less. Narrower account or owner filters and a data slice shrink each message, which also keeps memory use down.
  • Damaged stream: look for anything that rewrites bytes between you and the server, such as a TLS intercepting proxy, a client that sends cleartext to a TLS port, or a connection reused after an earlier error. Open a fresh channel, run the script on the number from each failure and compare the bytes.

After a change, reconnect and run the same subscription. If the error returns with a new number, decode it again. A different set of letters means the same kind of text reply, now in other words, and the path still has something answering that should not.

06

Where it ends

  • The error carries only the length. The compression flag byte stays hidden, and the script recognises a text reply only when all four length bytes are printable.
  • The verdict is a lead to check on the wire. A damaged stream whose bytes happen to be printable looks like a text reply.
  • A wrong length that sits under your limit never raises this error. The client then waits for body bytes that do not arrive.
  • The JSON size of a block shows scale. The stream sends protobuf messages whose sizes differ, so size your receive limit from blocks and updates you measure on the stream itself.
07

When it goes wrong

what goes wrongwhat to do
The script says text reply but the host and port look right.Look for a proxy, VPN or filtering gateway between the machine and port 9443. The text is that device's answer. Try again from a host with direct outbound access.
The plausible oversize error comes back after you raised the limit.The messages exceed the new limit too. Narrow the subscription with account or owner filters and a data slice, and size the limit from messages you measure.
The block measurement prints that a slot held no block.A slot with no block answers with an error. The script steps back up to five slots, and a second run starts from a newer finalized slot.
The script exits with a message about CARBIUM_KEY.Set CARBIUM_KEY in the environment of the shell that runs it. The decode above that point already printed and needs no key.
The connection opens but the stream is refused.Check that the account is on Dev, Business or Pro. The gRPC stream is off on Free.
08

Questions

What receive limit should I set after a plausible oversize verdict?

Size it from messages you measure on your own subscription, then add headroom. The error already tells you the current limit, 67108864 bytes, and any value above your largest measured message works. A narrower subscription lowers the need.

Does the error mean the server sent me 1.8 GiB?

No. The four length bytes spell uppl, so the client read text as a length and never received a message of that size.

Which address and header does the Carbium stream use?

The stream is https://services.carbium.sh:9443 with the key in the x-token header, open to Dev, Business and Pro accounts.

Can I decode a number without a key?

Yes. The decode prints first and needs no network. Only the block measurement needs CARBIUM_KEY, and the script exits with a message when it is unset.

Why does my number decode to different letters?

Each error carries its own reply, so another proxy or host gives other bytes. Four printable bytes mean text. Unprintable ones point to a real oversize message or a damaged stream.