grpc/grpc-go · error

router: incorrect config type provided (%T): %v

Error message

router: incorrect config type provided (%T): %v

What it means

BuildClientInterceptor asserts the listener-level config is the router builder's own config struct. A different type means a config produced by another filter builder was dispatched into the router builder.

Source

Thrown at internal/xds/httpfilter/router/router.go:96

func (builder) BuildClientFilter(httpfilter.ClientFilterOptions) httpfilter.ClientFilter {
	return filter{}
}

func (builder) BuildServerFilter() httpfilter.ServerFilter {
	return filter{}
}

var _ httpfilter.ClientFilterBuilder = builder{}
var _ httpfilter.ServerFilterBuilder = builder{}

type filter struct{}

func (filter) Close() {}

func (filter) BuildClientInterceptor(cfg, override httpfilter.FilterConfig) (httpfilter.ClientInterceptor, error) {
	if _, ok := cfg.(config); !ok {
		return nil, fmt.Errorf("router: incorrect config type provided (%T): %v", cfg, cfg)
	}
	if override != nil {
		return nil, fmt.Errorf("router: unexpected override configuration specified: %v", override)
	}
	// The gRPC router is implemented within the xds resolver's config
	// selector, not as a separate plugin.  So we return a nil HTTPFilter,
	// which will not be invoked.
	return nil, nil
}

func (filter) BuildServerInterceptor(cfg, override httpfilter.FilterConfig) (iresolver.ServerInterceptor, error) {
	if _, ok := cfg.(config); !ok {
		return nil, fmt.Errorf("router: incorrect config type provided (%T): %v", cfg, cfg)
	}
	if override != nil {
		return nil, fmt.Errorf("router: unexpected override configuration specified: %v", override)
	}
	// The gRPC router is currently unimplemented on the server side. So we

View on GitHub (pinned to 03255a9237)

Solutions

  1. Confirm no two registered httpfilter builders advertise the router TypeURL.
  2. Ensure the builder that produced the config is the router builder.
Defensive patterns

Strategy: type-guard

Type guard

// Keep parse and build of the router filter on the same builder instance
// so the concrete config type matches what BuildClientInterceptor expects.

Prevention

When it happens

Trigger: The httpfilter registry hands a non-router config to the router's BuildClientInterceptor - e.g. a TypeURL collision or misrouted filter chain.

Common situations: Filter misregistration; TypeURL collision between custom and built-in filters; internal dispatch bug.

Related errors


AI-assisted analysis of grpc/grpc-go@03255a9237 (2026-08-07). Data as JSON: /api/errors/0dfebd3be16c396b. Report an issue: GitHub.