grpc / grpc/grpc-java

Header list too large error gets changed to invalid content-type error

Aperta
#12,418 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub
bug
Lingua principale
Java
Stelle
12.1k
Fork
4k
Merge medio
2g 17h
PR unite (30g)
37

Descrizione

Hi!
We are seeing the following error message:
```
Caused by: io.grpc.StatusRuntimeException: INTERNAL: HTTP status code 431
invalid content-type: null
trailers: Metadata(:status=431,x-envoy-upstream-service-time=5,date=Wed, 08 Oct 2025 14:01:19 GMT,server=envoy)
at io.grpc.stub.ClientCalls.toStatusRuntimeException(ClientCalls.java:268)
at io.grpc.stub.ClientCalls.getUnchecked(ClientCalls.java:249)
at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:167)
```
The underlying issue here is that a header was too big and failed with:
```
431 INTERNAL ERROR header list size to send violates the maximum size (8192 bytes)
```
But the issue here is that the message:
`invalid content-type: null`
is misleading here and hides the original error, and causes confusion on what the error actually is. The issue seems to be that the client is expecting a `content-type: application/grpc` header to be present to parse the payload. But since the request failed when sending the headers, the response, which is an error response, doesn't have the `content-type` header set which causes the client to overwrite the original error.

Is this intended behavior or could the client handle this better? My guess here that this will be the case for any response where the headers are being validated as the request is prematurely interrupted.

I originally brought this up here https://github.com/envoyproxy/envoy/issues/41495 as the error included envoy. Envoy just forward this message to the client.

GRPC version is: 1.68.1

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Start with the ClientCalls.java stack-trace entry point and trace how the gRPC client handles an HTTP 431 response without a content-type header. Reproduce the oversized-header response described in the issue, then verify that the original 431/header-list error remains visible instead of being replaced by “invalid content-type: null”.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
grpc, java
Ambito
api
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.