grpc-ecosystem/grpc-gateway · error

the provided header type %q is not supported

Error message

the provided header type %q is not supported

What it means

Validation error at the end of validateDefaultValueTypeAndFormat: the header parameter's type is not one of the supported OpenAPI types (string, number, integer, boolean), so no type/format/default checks can apply. The offending input is the header option's type value, reported verbatim in the message.

Source

Thrown at protoc-gen-openapiv2/internal/genopenapi/template.go:2751

		case "uint",
			"uint8",
			"uint16",
			"uint32",
			"uint64",
			"int",
			"int8",
			"int16",
			"int32",
			"int64",
			"":
			return nil
		default:
			return fmt.Errorf("the provided format %q is not a valid extension of the type %q", format, headerType)
		}
	case "boolean":
		return nil
	}
	return fmt.Errorf("the provided header type %q is not supported", headerType)
}

func validateDefaultValueTypeAndFormat(headerType string, defaultValue string, format string) error {
	switch headerType {
	case "string":
		if !isQuotedString(defaultValue) {
			return fmt.Errorf("the provided default value %q does not match provider type %q, or is not properly quoted with escaped quotations", defaultValue, headerType)
		}
		switch format {
		case "date-time":
			unquoteTime := strings.Trim(defaultValue, `"`)
			if _, err := time.Parse(time.RFC3339, unquoteTime); err != nil {
				return fmt.Errorf("the provided default value %q is not a valid RFC3339 date-time string", defaultValue)
			}
		case "date":
			const layoutRFC3339Date = "2006-01-02"
			unquoteDate := strings.Trim(defaultValue, `"`)
			if _, err := time.Parse(layoutRFC3339Date, unquoteDate); err != nil {

View on GitHub (pinned to a58a4436a3)

Solutions

  1. Set the header parameter type to string, number, integer, or boolean.
  2. Remove the unsupported type from the openapiv2 header options.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at protoc-gen-openapiv2/internal/genopenapi/template.go:2751 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/c3756172b4a2fc8e. Report an issue: GitHub.