grpc/grpc-go · error
grpctransport: ServerURI is not set in ServerIdentifier
Error message
grpctransport: ServerURI is not set in ServerIdentifier
What it means
Returned by (*Builder).Build when clients.ServerIdentifier.ServerURI is the empty string (grpc_transport.go:91). Build requires a non-empty target URI because it is passed directly to grpc.NewClient; an empty URI is treated as a configuration error rather than a dial error.
Solutions
- Inspect the bootstrap configuration and ensure every xds_server / lrs_server has a non-empty server_uri.
- If building ServerIdentifier in code, validate ServerURI before calling Build.
- Log the offending ServerIdentifier at the call site to pinpoint which entry is empty.
Example fix
// before
si := clients.ServerIdentifier{} // ServerURI empty
tr, err := builder.Build(si)
// after
if si.ServerURI == "" {
return fmt.Errorf("server URI required for %v", si)
}
tr, err := builder.Build(si) Defensive patterns
Strategy: validation
Validate before calling
func validServerIdentifier(si clients.ServerIdentifier) error {
if si.ServerURI == "" {
return errors.New("ServerURI must be set")
}
return nil
}
// call before builder.Build(si) Try / catch
tr, err := builder.Build(si)
if err != nil && strings.Contains(err.Error(), "ServerURI is not set") {
// bootstrap is missing server_uri; fail fast with context
} Prevention
- Validate bootstrap JSON with a schema check that requires server_uri on every xds_server.
- Build ServerIdentifier in one helper and unit-test it.
- Log the ServerIdentifier at debug level before Build to catch empty fields.
When it happens
Trigger: Calling builder.Build(si) where si.ServerURI == "". Common when the ServerIdentifier is constructed from a bootstrap xds_server entry whose server_uri field is missing.
Common situations: Bootstrap configuration JSON is missing the "server_uri" field on an xds_server; a templated config left the URI blank; the LRS server config reuses an xDS server entry without copying the URI; programmatic bootstrap assembly bug.
Related errors
- grpctransport: Extensions is not set in ServerIdentifier
- grpctransport: config
- grpctransport: Extensions field is %T, but must be %T in…
- grpctransport: failed to create connection to server
- grpctransport: unknown config name
AI-assisted analysis of grpc/grpc-go@0c51461d27 (2026-08-11).
Data as JSON: /api/errors/34249a342e6a46fc.
Report an issue: GitHub.
Appendix: source
Thrown at internal/xds/clients/grpctransport/grpc_transport.go:91
}
// NewBuilder provides a builder for creating gRPC-based Transports using
// the credentials from provided map of credentials names to
// credentials.Bundle.
func NewBuilder(configs map[string]Config) *Builder {
return &Builder{
configs: configs,
connections: make(map[clients.ServerIdentifier]*grpc.ClientConn),
refs: make(map[clients.ServerIdentifier]int),
}
}
// Build returns a gRPC-based clients.Transport.
//
// The Extension field of the ServerIdentifier must be a ServerIdentifierExtension.
func (b *Builder) Build(si clients.ServerIdentifier) (clients.Transport, error) {
if si.ServerURI == "" {
return nil, fmt.Errorf("grpctransport: ServerURI is not set in ServerIdentifier")
}
if si.Extensions == nil {
return nil, fmt.Errorf("grpctransport: Extensions is not set in ServerIdentifier")
}
sce, ok := si.Extensions.(ServerIdentifierExtension)
if !ok {
return nil, fmt.Errorf("grpctransport: Extensions field is %T, but must be %T in ServerIdentifier", si.Extensions, ServerIdentifierExtension{})
}
config, ok := b.configs[sce.ConfigName]
if !ok {
return nil, fmt.Errorf("grpctransport: unknown config name %q specified in ServerIdentifierExtension", sce.ConfigName)
}
if config.Credentials == nil {
return nil, fmt.Errorf("grpctransport: config %q has nil credentials bundle", sce.ConfigName)
}
b.mu.Lock()View on GitHub (pinned to 0c51461d27)