grpc/grpc-go · error

authority %q not found in the config for resource %q

Error message

authority %q not found in the config for resource %q

What it means

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.

Source

Thrown at internal/xds/clients/xdsclient/clientimpl_watchers.go:79

		ResourceWatcher: watcher,
		nodeID:          c.config.Node.ID,
	}

	rType, ok := c.config.ResourceTypes[typeURL]
	if !ok {
		logger.Warningf("ResourceType implementation for resource type url %q is not found", rType.TypeURL)
		c.serializer.TrySchedule(func(context.Context) {
			watcher.ResourceError(fmt.Errorf("no ResourceType implementation found for typeURL %q", rType.TypeURL), func() {})
		})
		return func() {}
	}

	n := xdsresource.ParseName(resourceName)
	a := c.getAuthorityForResource(n)
	if a == nil {
		logger.Warningf("Watch registered for name %q of type %q, authority %q is not found", rType.TypeName, resourceName, n.Authority)
		c.serializer.TrySchedule(func(context.Context) {
			watcher.ResourceError(fmt.Errorf("authority %q not found in the config for resource %q", n.Authority, resourceName), func() {})
		})
		return func() {}
	}
	// The watchResource method on the authority is invoked with n.String()
	// instead of resourceName because n.String() canonicalizes the given name.
	// So, two resource names which don't differ in the query string, but only
	// differ in the order of context params will result in the same resource
	// being watched by the authority.
	return a.watchResource(rType, n.String(), watcher)
}

// Gets the authority for the given resource name.
//
// See examples in this section of the gRFC:
// https://github.com/grpc/proposal/blob/master/A47-xds-federation.md#bootstrap-config-changes
func (c *XDSClient) getAuthorityForResource(name *xdsresource.Name) *authority {
	// For new-style resource names, always lookup the authorities map. If the
	// name does not specify an authority, we will end up looking for an entry

View on GitHub (pinned to 03255a9237)

Solutions

  1. Add the authority to Config.Authorities with its XDSServers before constructing the XDSClient.
  2. Verify the authority segment of the resource name string matches a key in Authorities exactly (case-sensitive, no trailing slash).
  3. For non-federated names without an authority, ensure the name has no authority portion so it routes to the top-level authority.

Example fix

// before: authority 'us-east' not configured
c.WatchResource("xdstp://us-east/foo", "bar", w)

// after: declare the authority in Config
cfg := xdsclient.Config{
  Authorities: map[string]*Authority{
    "us-east": {XDSServers: []*ServerConfig{...}},
  },
}
Defensive patterns

Strategy: validation

Validate before calling

// Confirm the authority in a resource name is configured before watching.
func authorityConfigured(cfg xdsclient.Config, resourceName string) bool {
    n := xdsresource.ParseName(resourceName)
    _, ok := cfg.Authorities[n.Authority]
    return ok || n.Authority == "" // top-level authority
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of grpc/grpc-go@03255a9237 (2026-08-07). Data as JSON: /api/errors/e8945ceb93e148aa. Report an issue: GitHub.