grpc/grpc-go · error

router: error parsing config %v: unknown type %T

Error message

router: error parsing config %v: unknown type %T

What it means

ParseFilterConfig expects an *anypb.Any. Any other concrete Go type indicates the xDS marshaling layer delivered the wrong type to the router builder - an internal wiring issue.

Source

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

func IsRouterFilter(b httpfilter.Builder) bool {
	_, ok := b.(builder)
	return ok
}

type builder struct {
}

func (builder) TypeURLs() []string { return []string{TypeURL} }

func (builder) ParseFilterConfig(cfg proto.Message) (httpfilter.FilterConfig, error) {
	// The gRPC router filter does not currently use any fields from the
	// config.  Verify type only.
	if cfg == nil {
		return nil, fmt.Errorf("router: nil configuration message provided")
	}
	m, ok := cfg.(*anypb.Any)
	if !ok {
		return nil, fmt.Errorf("router: error parsing config %v: unknown type %T", cfg, cfg)
	}
	msg := new(pb.Router)
	if err := m.UnmarshalTo(msg); err != nil {
		return nil, fmt.Errorf("router: error parsing config %v: %v", cfg, err)
	}
	return config{}, nil
}

func (builder) ParseFilterConfigOverride(override proto.Message) (httpfilter.FilterConfig, error) {
	if override != nil {
		return nil, fmt.Errorf("router: unexpected config override specified: %v", override)
	}
	return config{}, nil
}

func (builder) IsTerminal() bool {
	return true
}

View on GitHub (pinned to 03255a9237)

Solutions

  1. Ensure xDS marshaling wraps router config in *anypb.Any before invoking the builder.
  2. Verify the resource @type matches the router TypeURL.
Defensive patterns

Strategy: type-guard

Type guard

func isAny(m proto.Message) bool { _, ok := m.(*anypb.Any); return ok }

Prevention

When it happens

Trigger: A non-Any proto.Message is passed to the router's ParseFilterConfig.

Common situations: Custom xDS client bypassing the Any convention; version skew; a fork altering the marshaling pipeline.

Related errors


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