The gRPC Status Is a Header (and the Failed Call Puts It in a Different One)
The body is half a gRPC call. The other half rides in HTTP/2 headers, and there is almost nothing special about it. I sent x-trace-id: trace-abc-123 on a real call against a local grpc-js server and it arrived in the handler as a plain string, read with call.metadata.get('x-trace-id'), which returns a list of strings because a header can carry more than one value. A missing key comes back as an empty list, not an error. Nothing in these headers is protobuf. It is text, sent the way HTTP/2 sends everything, and the tooling that cares about the bytes of the message never looks at it at all.
The one rule that looks like magic is the -bin suffix. A key that ends in -bin says its value is binary, and the form on the wire is base64 of the raw bytes. I sent x-auth-bin holding the base64 of deadbeef0001 and the server side gave me back exactly that Buffer, decoded. The client API enforces the direction it cares about: set a -bin key with a plain string and it throws, keys that end with -bin must have Buffer values, a key containing a space throws on illegal characters, and every key is lowered to lowercase before it leaves the process. add() stacks a second value under the same key, but getMap() returns only the first, so a multi-value header reads as a list and dumps as one. Small API, and every behavior is checkable against your own traffic.
Now the status, because it is the header that matters and it moves. On a successful call the response headers carry the content-type and the grpc-encoding negotiation and no status at all. The body frame goes out, flag, length, payload, the one the decode tabs strip. And the status arrives later, in a separate HEADERS frame after the body: the trailers, grpc-status: 0, grpc-message: OK. On a failed call the server puts the status in the initial headers instead, a trailers-only response the protocol explicitly allows, and the call ends there, no body, no trailers frame. I measured both against a local server with a raw HTTP/2 client. The practical consequence is the one you feel when debugging: a decoder that goes to the trailers to find the error code will not find it, on precisely the calls that failed.
And the message in those headers is not the message. grpc-message is percent-encoded on the wire: the error name is too long (7): abc%def went out as name%20is%20too%20long%20(7):%20abc%25def, space became %20, the percent became %25, and the parentheses and the colon were left alone. The client library hands you the decoded string back, so a normal application never sees the encoding. But a person reading a captured header by hand sees abc%25def and quotes the error as abc%25def. Decode the percent-encoding before you write the error down, or the log is lying about the message by one character.
That is the whole protocol around the body: headers in, metadata, headers out, the status once, either in the trailers or in-band, never both. The decode tab on proto.datajutsu.com handles the body side, it strips the five-byte frame header, gunzips the compressed frames, and walks a multi-frame stream into an array. The headers you still read in your capture tool, because the wire does not mix the two: the status code and the reason sit in the response, and on the failed path they sit in the first one. The walkthrough of a real captured response body is the bytes inside this post's frame, and the request-side framing post is where the same five-byte header is built by hand.