grpc / grpc/grpc-java

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

Abierto
#12,418 2 comentarios 0 reacciones 0 asignados Ver en GitHub
bug
Lenguaje dominante
Java
Estrellas
12.1k
Forks
4k
Merge medio
2 d 17 h
PR fusionados (30 d)
37

Descripción

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

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Comienza con el punto de entrada del stack trace en ClientCalls.java y sigue cómo el cliente gRPC gestiona una respuesta HTTP 431 sin un encabezado content-type. Reproduce la respuesta con encabezados sobredimensionados descrita en el issue y verifica después que el error original de 431/header-list siga siendo visible, en lugar de ser reemplazado por «invalid content-type: null».

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
grpc, java
Área
api
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
45/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.