grpc/grpc-go · error

fault: nil config provided

Error message

fault: nil config provided

What it means

BuildClientInterceptor rejects a nil base config (fault.go:119). The interceptor cannot be built without fault settings, so nil is a hard error here (unlike a config that simply disables faults, which returns a nil interceptor cleanly).

Source

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

}

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

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

var _ httpfilter.ClientFilterBuilder = builder{}

type clientFilter struct{}

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

View on GitHub (pinned to 03255a9237)

Solutions

  1. Ensure the listener-level fault config produced by ParseFilterConfig is passed through to BuildClientInterceptor.
  2. If fault injection is disabled, pass a real config that yields a nil interceptor (max_active_faults==0 or no delay and no abort) rather than nil itself.
  3. Add an assertion in your filter wiring that cfg is non-nil before building.

Example fix

// before
ic, err := cf.BuildClientInterceptor(nil, override)

// after: pass the parsed config (use a disabling config rather than nil)
ic, err := cf.BuildClientInterceptor(parsedCfg, override)
Defensive patterns

Strategy: validation

Validate before calling

if cfg == nil {
    return nil, errors.New("refusing to build fault interceptor with nil config")
}

Try / catch

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

Prevention

When it happens

Trigger: BuildClientInterceptor is called with cfg == nil.

Common situations: Filter chain wired with the fault builder but the listener-level config object was never created; programmatic misuse passing nil; a routing path that drops the parsed config.

Related errors


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