grpc/grpc-go · error

fault: incorrect override config type provided (%T)

Error message

fault: incorrect override config type provided (%T): %v

What it means

BuildClientInterceptor (fault.go:132) applies the same type check to the override config when it is non-nil. The override must also be the fault filter's internal config type; otherwise the assertion fails.

Solutions

  1. Parse the override with the fault builder's ParseFilterConfigOverride before passing it.
  2. Ensure the per-route override in the xDS Route uses the fault TypeURL.
  3. Do not pass overrides produced by other filter builders.

Example fix

// before
ic, err := faultCF.BuildClientInterceptor(cfg, otherBuilderOverride)

// after
override, err := faultBuilder.ParseFilterConfigOverride(anyOverride)
ic, err := faultCF.BuildClientInterceptor(cfg, override)
Defensive patterns

Strategy: type-guard

Validate before calling

if override != nil {
    // Ensure override came from the same fault builder's ParseFilterConfigOverride.
    if _, ok := override.(httpfilter.FilterConfig); !ok { /* still wrong type internally */ }
}

Try / catch

ic, err := cf.BuildClientInterceptor(cfg, override)
if err != nil && strings.Contains(err.Error(), "incorrect override config type") {
    override, oerr := faultBuilder.ParseFilterConfigOverride(anyOverride)
    if oerr != nil { return oerr }
    ic, err = cf.BuildClientInterceptor(cfg, override)
}

Prevention

When it happens

Trigger: BuildClientInterceptor is called with a non-nil override that is not the fault filter's internal config struct (e.g., an override parsed by a different builder, or a raw *fpb.HTTPFault).

Common situations: Override config parsed by the wrong builder; control-plane sending a per-route override with the wrong typed config; refactor that swapped builders.

Related errors


AI-assisted analysis of grpc/grpc-go@0c51461d27 (2026-08-11). Data as JSON: /api/errors/5e24bb381877d1e8. Report an issue: GitHub.

Appendix: source

Thrown at internal/xds/httpfilter/fault/fault.go:133

func (clientFilter) Close() {}

func (clientFilter) BuildClientInterceptor(cfg, override httpfilter.FilterConfig) (httpfilter.ClientInterceptor, error) {
	if cfg == nil {
		return nil, fmt.Errorf("fault: nil config provided")
	}

	c, ok := cfg.(config)
	if !ok {
		return nil, fmt.Errorf("fault: incorrect config type provided (%T): %v", cfg, cfg)
	}

	if override != nil {
		// override completely replaces the listener configuration; but we
		// still validate the listener config type.
		c, ok = override.(config)
		if !ok {
			return nil, fmt.Errorf("fault: incorrect override config type provided (%T): %v", override, override)
		}
	}

	icfg := c.config
	if (icfg.GetMaxActiveFaults() != nil && icfg.GetMaxActiveFaults().GetValue() == 0) ||
		(icfg.GetDelay() == nil && icfg.GetAbort() == nil) {
		return nil, nil
	}
	return &interceptor{config: icfg}, nil
}

type interceptor struct {
	config *fpb.HTTPFault
}

var activeFaults uint32 // global active faults; accessed atomically

func (i *interceptor) NewStream(ctx context.Context, _ iresolver.RPCInfo, newStream func(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStream, error), opts ...grpc.CallOption) (grpc.ClientStream, error) {

View on GitHub (pinned to 0c51461d27)