grpc/grpc-go · error

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

Error message

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

What it means

When an override config is present, BuildClientInterceptor requires it to be the fault builder's own config type (fault.go:131). A non-fault override type is rejected because the override fully replaces the base config and must be structurally compatible.

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 03255a9237)

Solutions

  1. Route per-route fault overrides through ParseFilterConfigOverride of the fault builder so they are the correct type.
  2. Pass nil for override when no per-route fault config applies.
  3. Verify the per-route typed config's TypeURL resolves to the fault builder, not a sibling filter.

Example fix

// before: override is the raw HTTPFault or a foreign config
ic, err := cf.BuildClientInterceptor(base, foreignOverride)

// after: override produced by the fault builder's override parser
override, err := faultBuilder.ParseFilterConfigOverride(overrideAny)
ic, err := cf.BuildClientInterceptor(base, override)
Defensive patterns

Strategy: type-guard

Validate before calling

if override != nil {
    // override must be produced by the fault builder's ParseFilterConfigOverride
}

Type guard

// Override type is unexported; ensure it came from ParseFilterConfigOverride of the same builder.

Try / catch

ic, err := cf.BuildClientInterceptor(cfg, override)
if err != nil {
    return err
}

Prevention

When it happens

Trigger: override passed to BuildClientInterceptor is non-nil but not the internal fault config struct (e.g. it came from a different filter builder or was never parsed by the fault builder).

Common situations: Per-route override decoded by the wrong builder; override config object reused across filters; framework that supplies a generic override wrapper.

Related errors


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