{"record":{"id":"540c1635e488b6cf","repo":"grpc/grpc-go","slug":"fault-nil-config-provided","errorCode":null,"errorMessage":"fault: nil config provided","messagePattern":"fault: nil config provided","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/xds/httpfilter/fault/fault.go","lineNumber":120,"sourceCode":"}\n\nfunc (builder) IsTerminal() bool {\n\treturn false\n}\n\nfunc (builder) BuildClientFilter(httpfilter.ClientFilterOptions) httpfilter.ClientFilter {\n\treturn clientFilter{}\n}\n\nvar _ httpfilter.ClientFilterBuilder = builder{}\n\ntype clientFilter struct{}\n\nfunc (clientFilter) Close() {}\n\nfunc (clientFilter) BuildClientInterceptor(cfg, override httpfilter.FilterConfig) (httpfilter.ClientInterceptor, error) {\n\tif cfg == nil {\n\t\treturn nil, fmt.Errorf(\"fault: nil config provided\")\n\t}\n\n\tc, ok := cfg.(config)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"fault: incorrect config type provided (%T): %v\", cfg, cfg)\n\t}\n\n\tif override != nil {\n\t\t// override completely replaces the listener configuration; but we\n\t\t// still validate the listener config type.\n\t\tc, ok = override.(config)\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"fault: incorrect override config type provided (%T): %v\", override, override)\n\t\t}\n\t}\n\n\ticfg := c.config\n\tif (icfg.GetMaxActiveFaults() != nil && icfg.GetMaxActiveFaults().GetValue() == 0) ||","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/grpc/grpc-go/blob/0c51461d27177d997e14c642fe18c11668fc09a3/internal/xds/httpfilter/fault/fault.go#L102-L138","documentation":"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.","triggerScenarios":"BuildClientInterceptor(nil, override) is invoked, typically because a caller bypassed ParseFilterConfig or the parse returned an error that was ignored.","commonSituations":"Custom xDS bootstrap code that constructs interceptors manually; swallowed parse error; test setup that omitted the config.","solutions":["Always pass the non-nil config returned by ParseFilterConfig into BuildClientInterceptor.","Check and propagate the error from ParseFilterConfig before building the interceptor.","If no fault config is desired, do not register the fault filter at all."],"exampleFix":"// before\nic, err := cf.BuildClientInterceptor(nil, override)\n\n// after\nparsed, err := b.ParseFilterConfig(anyCfg)\nif err != nil { return err }\nic, err := cf.BuildClientInterceptor(parsed, override)","handlingStrategy":"validation","validationCode":"if cfg == nil {\n    return nil, errors.New(\"fault: refusing to build interceptor with nil config\")\n}","typeGuard":null,"tryCatchPattern":"parsed, err := faultBuilder.ParseFilterConfig(anyCfg)\nif err != nil { return err }\nic, err := faultCF.BuildClientInterceptor(parsed, override)","preventionTips":["Always thread the output of ParseFilterConfig into BuildClientInterceptor.","Never swallow parse errors before building the interceptor."],"tags":["fault","config","grpc","xds"],"backgroundTag":null,"analyzedSha":"0c51461d27177d997e14c642fe18c11668fc09a3","analyzedAt":"2026-08-11T14:49:15.055Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}