{"record":{"id":"e8945ceb93e148aa","repo":"grpc/grpc-go","slug":"authority-q-not-found-in-the-config-for-resource","errorCode":null,"errorMessage":"authority %q not found in the config for resource %q","messagePattern":"authority %q not found in the config for resource %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/xds/clients/xdsclient/clientimpl_watchers.go","lineNumber":79,"sourceCode":"\t\tResourceWatcher: watcher,\n\t\tnodeID:          c.config.Node.ID,\n\t}\n\n\trType, ok := c.config.ResourceTypes[typeURL]\n\tif !ok {\n\t\tlogger.Warningf(\"ResourceType implementation for resource type url %q is not found\", rType.TypeURL)\n\t\tc.serializer.TrySchedule(func(context.Context) {\n\t\t\twatcher.ResourceError(fmt.Errorf(\"no ResourceType implementation found for typeURL %q\", rType.TypeURL), func() {})\n\t\t})\n\t\treturn func() {}\n\t}\n\n\tn := xdsresource.ParseName(resourceName)\n\ta := c.getAuthorityForResource(n)\n\tif a == nil {\n\t\tlogger.Warningf(\"Watch registered for name %q of type %q, authority %q is not found\", rType.TypeName, resourceName, n.Authority)\n\t\tc.serializer.TrySchedule(func(context.Context) {\n\t\t\twatcher.ResourceError(fmt.Errorf(\"authority %q not found in the config for resource %q\", n.Authority, resourceName), func() {})\n\t\t})\n\t\treturn func() {}\n\t}\n\t// The watchResource method on the authority is invoked with n.String()\n\t// instead of resourceName because n.String() canonicalizes the given name.\n\t// So, two resource names which don't differ in the query string, but only\n\t// differ in the order of context params will result in the same resource\n\t// being watched by the authority.\n\treturn a.watchResource(rType, n.String(), watcher)\n}\n\n// Gets the authority for the given resource name.\n//\n// See examples in this section of the gRFC:\n// https://github.com/grpc/proposal/blob/master/A47-xds-federation.md#bootstrap-config-changes\nfunc (c *XDSClient) getAuthorityForResource(name *xdsresource.Name) *authority {\n\t// For new-style resource names, always lookup the authorities map. If the\n\t// name does not specify an authority, we will end up looking for an entry","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/grpc/grpc-go/blob/03255a9237b6eb32710f6bc4f2de9a675b99fe36/internal/xds/clients/xdsclient/clientimpl_watchers.go#L61-L97","documentation":"Reported to the watcher by XDSClient.WatchResource when the parsed resource name carries an authority that is not present in Config.Authorities (and is not the empty top-level authority). The watch does not start; WatchResource returns a no-op cancel and the watcher gets a ResourceError.","triggerScenarios":"Calling WatchResource with a federation-style name ('xdstp://<authority>/...') whose authority string does not match any key in the Authorities map of the Config, or an old-style name with a non-empty authority that has no matching config entry.","commonSituations":"Bootstrap/Config Authorities missing the authority the resource name references, a typo in the authority portion of the resource name, or a federation config where the client and server disagree on authority names.","solutions":["Add the authority to Config.Authorities with its XDSServers before constructing the XDSClient.","Verify the authority segment of the resource name string matches a key in Authorities exactly (case-sensitive, no trailing slash).","For non-federated names without an authority, ensure the name has no authority portion so it routes to the top-level authority."],"exampleFix":"// before: authority 'us-east' not configured\nc.WatchResource(\"xdstp://us-east/foo\", \"bar\", w)\n\n// after: declare the authority in Config\ncfg := xdsclient.Config{\n  Authorities: map[string]*Authority{\n    \"us-east\": {XDSServers: []*ServerConfig{...}},\n  },\n}","handlingStrategy":"validation","validationCode":"// Confirm the authority in a resource name is configured before watching.\nfunc authorityConfigured(cfg xdsclient.Config, resourceName string) bool {\n    n := xdsresource.ParseName(resourceName)\n    _, ok := cfg.Authorities[n.Authority]\n    return ok || n.Authority == \"\" // top-level authority\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Declare every authority referenced by resource names in Config.Authorities.","For non-federated resources, omit the authority so they route to the top-level authority.","Parse and validate resource names before calling WatchResource."],"tags":["grpc","xds","federation","authority","config"],"analyzedSha":"03255a9237b6eb32710f6bc4f2de9a675b99fe36","analyzedAt":"2026-08-07T00:29:34.215Z","schemaVersion":2},"datasetVersion":"2026-08-07T03:17:09.362Z"}