grpc-ecosystem/grpc-gateway · error
invalid header parameter type: %+v
Error message
invalid header parameter type: %+v
What it means
Schema-mapping error in genopenapi renderServices: an openapi_options HeaderParameter has a type enum value outside the known STRING/NUMBER/INTEGER/BOOLEAN set, so the generator cannot map it to an OpenAPI parameter type. The failing input is the header parameter option with the unsupported type value.
Source
Thrown at protoc-gen-openapiv2/internal/genopenapi/template.go:2190
param := openapiParameterObject{
In: "header",
Name: header.Name,
Description: header.Description,
Required: header.Required,
Format: header.Format,
}
switch header.Type {
case openapi_options.HeaderParameter_STRING:
param.Type = "string"
case openapi_options.HeaderParameter_NUMBER:
param.Type = "number"
case openapi_options.HeaderParameter_INTEGER:
param.Type = "integer"
case openapi_options.HeaderParameter_BOOLEAN:
param.Type = "boolean"
default:
return fmt.Errorf("invalid header parameter type: %+v", header.Type)
}
operationObject.Parameters = append(operationObject.Parameters, param)
}
}
// TODO(ivucica): add remaining fields of operation object
}
switch b.HTTPMethod {
case "DELETE":
pathItemObject.Delete = operationObject
case "GET":
pathItemObject.Get = operationObject
case "POST":
pathItemObject.Post = operationObject
case "PUT":
pathItemObject.Put = operationObjectView on GitHub (pinned to a58a4436a3)
Solutions
- Set the header parameter's type to one of STRING, NUMBER, INTEGER, or BOOLEAN in the openapiv2 options.
- Regenerate if a newer plugin supports additional header types.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at protoc-gen-openapiv2/internal/genopenapi/template.go:2190 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of grpc-ecosystem/grpc-gateway@a58a4436a3 (2026-09-02).
Data as JSON: /api/errors/851fe7b93f694d11.
Report an issue: GitHub.