{"record":{"id":"092a0d60418031ae","repo":"grpc/grpc-go","slug":"fault-nil-configuration-message-provided","errorCode":null,"errorMessage":"fault: nil configuration message provided","messagePattern":"fault: nil configuration message provided","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/xds/httpfilter/fault/fault.go","lineNumber":83,"sourceCode":"\thttpfilter.Register(builder{})\n}\n\ntype builder struct {\n}\n\ntype config struct {\n\thttpfilter.FilterConfig\n\tconfig *fpb.HTTPFault\n}\n\nfunc (builder) TypeURLs() []string {\n\treturn []string{\"type.googleapis.com/envoy.extensions.filters.http.fault.v3.HTTPFault\"}\n}\n\n// Parsing is the same for the base config and the override config.\nfunc parseConfig(cfg proto.Message) (httpfilter.FilterConfig, error) {\n\tif cfg == nil {\n\t\treturn nil, fmt.Errorf(\"fault: nil configuration message provided\")\n\t}\n\tm, ok := cfg.(*anypb.Any)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"fault: error parsing config %v: unknown type %T\", cfg, cfg)\n\t}\n\tmsg := new(fpb.HTTPFault)\n\tif err := m.UnmarshalTo(msg); err != nil {\n\t\treturn nil, fmt.Errorf(\"fault: error parsing config %v: %v\", cfg, err)\n\t}\n\treturn config{config: msg}, nil\n}\n\nfunc (builder) ParseFilterConfig(cfg proto.Message) (httpfilter.FilterConfig, error) {\n\treturn parseConfig(cfg)\n}\n\nfunc (builder) ParseFilterConfigOverride(override proto.Message) (httpfilter.FilterConfig, error) {\n\treturn parseConfig(override)","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/grpc/grpc-go/blob/0c51461d27177d997e14c642fe18c11668fc09a3/internal/xds/httpfilter/fault/fault.go#L65-L101","documentation":"parseConfig (fault.go:82) rejects a nil proto.Message up front. The fault filter requires an *anypb.Any wrapping an HTTPFault proto; a nil cfg means the xDS layer handed nothing to the parser, which is always a programming or control-plane error.","triggerScenarios":"ParseFilterConfig(nil) or ParseFilterConfigOverride(nil) is invoked, either directly or because the xDS resource contained a nil-typed config proto for the fault filter.","commonSituations":"xDS server emits a fault filter entry with an empty/absent config; programmatic registration of the filter with nil; test code that forgot to populate the config.","solutions":["Provide a non-nil *anypb.Any wrapping a populated fpb.HTTPFault proto to ParseFilterConfig.","Inspect the xDS Listener resource to confirm the fault filter's typed_config is present and has the correct type URL.","If fault injection is not desired, remove the filter from the Listener rather than sending nil."],"exampleFix":"// before\nfc, err := faultBuilder.ParseFilterConfig(nil)\n\n// after\nanyCfg, _ := anypb.New(&fpb.HTTPFault{Abort: &cpb.FaultAbort{...}})\nfc, err := faultBuilder.ParseFilterConfig(anyCfg)","handlingStrategy":"validation","validationCode":"if cfg == nil {\n    return nil, errors.New(\"fault: refusing to parse nil config\")\n}","typeGuard":null,"tryCatchPattern":"fc, err := faultBuilder.ParseFilterConfig(anyCfg)\nif err != nil {\n    if strings.Contains(err.Error(), \"nil configuration message\") {\n        // control-plane sent an empty fault filter entry; remove it or populate it\n    }\n    return err\n}","preventionTips":["Always populate the fault filter's typed_config in the xDS Listener.","Reject nil configs at the control-plane before they reach the data-plane.","Unit-test programmatic registration paths with non-nil inputs."],"tags":["fault","config","xds","grpc"],"backgroundTag":null,"analyzedSha":"0c51461d27177d997e14c642fe18c11668fc09a3","analyzedAt":"2026-08-11T14:49:15.055Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}