grpc/grpc-go · error

fault: nil config provided

Error message

fault: nil config provided

What it means

BuildClientInterceptor (fault.go:119) rejects a nil cfg. The interceptor construction requires the FilterConfig produced by ParseFilterConfig; passing nil indicates the filter chain was wired without parsing.

Solutions

  1. Always pass the non-nil config returned by ParseFilterConfig into BuildClientInterceptor.
  2. Check and propagate the error from ParseFilterConfig before building the interceptor.
  3. If no fault config is desired, do not register the fault filter at all.

Example fix

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

// after
parsed, err := b.ParseFilterConfig(anyCfg)
if err != nil { return err }
ic, err := cf.BuildClientInterceptor(parsed, override)
Defensive patterns

Strategy: validation

Validate before calling

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

Try / catch

parsed, err := faultBuilder.ParseFilterConfig(anyCfg)
if err != nil { return err }
ic, err := faultCF.BuildClientInterceptor(parsed, override)

Prevention

When it happens

Trigger: BuildClientInterceptor(nil, override) is invoked, typically because a caller bypassed ParseFilterConfig or the parse returned an error that was ignored.

Common situations: Custom xDS bootstrap code that constructs interceptors manually; swallowed parse error; test setup that omitted the config.

Related errors


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

Appendix: 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 0c51461d27)