{"record":{"id":"b3c6148babdec911","repo":"grpc/grpc-go","slug":"no-supported-policies-found-in-config-v","errorCode":null,"errorMessage":"no supported policies found in config: %v","messagePattern":"no supported policies found in config: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/balancer/gracefulswitch/config.go","lineNumber":83,"sourceCode":"\t\tif builder == nil {\n\t\t\t// Skip unregistered balancer names.\n\t\t\tcontinue\n\t\t}\n\n\t\tparser, ok := builder.(balancer.ConfigParser)\n\t\tif !ok {\n\t\t\t// This is a valid child with no config.\n\t\t\treturn &lbConfig{childBuilder: builder}, nil\n\t\t}\n\n\t\tcfg, err := parser.ParseConfig(jsonCfg)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error parsing config for policy %q: %v\", name, err)\n\t\t}\n\t\treturn &lbConfig{childBuilder: builder, childConfig: cfg}, nil\n\t}\n\n\treturn nil, fmt.Errorf(\"no supported policies found in config: %v\", string(cfg))\n}\n","sourceCodeStart":65,"sourceCodeEnd":85,"githubUrl":"https://github.com/grpc/grpc-go/blob/0c51461d27177d997e14c642fe18c11668fc09a3/internal/balancer/gracefulswitch/config.go#L65-L85","documentation":"Returned by gracefulswitch.ParseConfig after iterating through all entries in the loadBalancingConfig array and finding no registered balancer builder for any policy name. Unregistered names are silently skipped (config.go:65-68: 'Skip unregistered balancer names'), so if every name is unregistered, the loop completes with no match and this error fires.","triggerScenarios":"Calling ParseConfig with a loadBalancingConfig array where every policy name fails balancer.Get(name) == nil. For example, referencing 'grpclb' when that package is not imported, or using 'roundrobin' (no underscore) instead of the registered 'round_robin'.","commonSituations":"Forgetting to import a balancer package for its init() side effect (e.g., missing _ \"google.golang.org/grpc/balancer/roundrobin\"). Using a balancer name from a different gRPC language or version. Typos in policy names in the service config.","solutions":["Verify each policy name is spelled correctly and matches a name registered via balancer.Register()","Import the balancer package for its init side effect: _ \"google.golang.org/grpc/balancer/roundrobin\"","Check registration at runtime with balancer.Get(name) before relying on it","Print registered balancers if unsure what names are available"],"exampleFix":"// before: 'roundrobin' is not the registered name\n\"loadBalancingConfig\": [{\"roundrobin\":{}}]\n\n// after: 'round_robin' is the registered name\n\"loadBalancingConfig\": [{\"round_robin\":{}}]\n\n// also ensure the import exists:\nimport _ \"google.golang.org/grpc/balancer/roundrobin\"","handlingStrategy":"validation","validationCode":"// Check that at least one policy name is registered before calling ParseConfig\nfunc hasRegisteredPolicy(raw json.RawMessage) error {\n    var entries []map[string]json.RawMessage\n    if err := json.Unmarshal(raw, &entries); err != nil {\n        return err\n    }\n    found := false\n    for _, e := range entries {\n        for name := range e {\n            if balancer.Get(name) != nil {\n                found = true\n            }\n        }\n    }\n    if !found {\n        return fmt.Errorf(\"no registered balancer found in config\")\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Import balancer packages for their init() side effects: _ \"google.golang.org/grpc/balancer/roundrobin\"","Use balancer.Get(name) to verify registration before relying on a policy name","Keep a list of supported balancer names for your binary and validate configs against it"],"tags":["grpc","balancer","config","gracefulswitch","registration"],"backgroundTag":null,"analyzedSha":"0c51461d27177d997e14c642fe18c11668fc09a3","analyzedAt":"2026-08-11T14:49:15.055Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}