{"record":{"id":"e6a3997f97771c83","repo":"grpc/grpc-go","slug":"lrsclient-failed-to-create-transport-for-server-i","errorCode":null,"errorMessage":"lrsclient: failed to create transport for server identifier %s: %v","messagePattern":"lrsclient: failed to create transport for server identifier (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/xds/clients/lrsclient/lrsclient.go","lineNumber":120,"sourceCode":"\n\t// Use an existing stream, if one exists for this server identifier.\n\tif s, ok := c.lrsStreams[serverIdentifier]; ok {\n\t\tif c.logger.V(2) {\n\t\t\tc.logger.Infof(\"Reusing an existing lrs stream for server identifier %q\", serverIdentifier)\n\t\t}\n\t\tc.lrsRefs[serverIdentifier]++\n\t\treturn s, nil\n\t}\n\n\tif c.logger.V(2) {\n\t\tc.logger.Infof(\"Creating a new lrs stream for server identifier %q\", serverIdentifier)\n\t}\n\n\t// Create a new transport and create a new lrs stream, and add it to the\n\t// map of lrs streams.\n\ttr, err := c.transportBuilder.Build(serverIdentifier)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"lrsclient: failed to create transport for server identifier %s: %v\", serverIdentifier, err)\n\t}\n\n\tnodeProto := clientsinternal.NodeProto(c.node)\n\tnodeProto.ClientFeatures = []string{clientFeatureNoOverprovisioning, clientFeatureResourceWrapper}\n\tlrs := newStreamImpl(streamOpts{\n\t\ttransport: tr,\n\t\tbackoff:   c.backoff,\n\t\tnodeProto: nodeProto,\n\t\tlogPrefix: clientPrefix(c),\n\t})\n\n\t// Register a stop function that decrements the reference count, stops\n\t// the LRS stream when the last reference is removed and closes the\n\t// transport and removes the lrs stream and its references from the\n\t// respective maps. Before closing the stream, it waits for the provided\n\t// context to be done (timeout or cancellation).\n\tstop := func(ctx context.Context) {\n\t\tc.mu.Lock()","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/grpc/grpc-go/blob/03255a9237b6eb32710f6bc4f2de9a675b99fe36/internal/xds/clients/lrsclient/lrsclient.go#L102-L138","documentation":"Returned by LRSClient.ReportLoad (via getOrCreateLRSStream) when the configured TransportBuilder.Build(serverIdentifier) fails. It is a hard error returned to the caller, not internally retried, because transport construction is a prerequisite to opening any stream.","triggerScenarios":"ReportLoad is called with a ServerIdentifier whose URI cannot be resolved, whose credentials/transport security cannot be established, or for which the transport builder rejects the config. The first ReportLoad for a given server identifier triggers a new transport; subsequent calls reuse the existing one.","commonSituations":"Bad ServerURI, missing or malformed credentials in the TransportBuilder, an unresolvable DNS name, or a custom TransportBuilder that returns an error on authority/URI validation.","solutions":["Validate the ServerIdentifier (ServerURI reachable, Authority set) before calling ReportLoad.","Inspect the wrapped %v: dial errors mean DNS/network, permission errors mean credentials, config errors mean the builder rejected inputs.","Ensure the TransportBuilder was constructed with credentials matching the server (e.g. xds.Credentials for TLS).","Handle the returned error from ReportLoad rather than ignoring it, since it is not retried by the client."],"exampleFix":"// before\nls, err := c.ReportLoad(si)\nif err != nil { log.Fatal(err) }\n\n// after: pre-validate and degrade gracefully\nls, err := c.ReportLoad(si)\nif err != nil {\n    logger.Warnf(\"LRS transport unavailable for %s: %v\", si.ServerURI, err)\n    return // skip load reporting; app traffic continues\n}","handlingStrategy":"try-catch","validationCode":"// Validate the server identifier is buildable before ReportLoad.\nfunc validateServerID(b clients.TransportBuilder, si clients.ServerIdentifier) error {\n    tr, err := b.Build(si)\n    if err != nil { return err }\n    tr.Close()\n    return nil\n}","typeGuard":null,"tryCatchPattern":"ls, err := c.ReportLoad(si)\nif err != nil {\n    // hard error: not retried by the client\n    logger.Errorf(\"cannot start LRS for %s: %v\", si.ServerURI, err)\n    return\n}","preventionTips":["Construct the TransportBuilder with credentials that match the target server.","Validate ServerIdentifier URI (resolvable host, numeric port) before use.","Handle ReportLoad's returned error explicitly; it is not retried internally."],"tags":["grpc","xds","lrs","transport","config"],"analyzedSha":"03255a9237b6eb32710f6bc4f2de9a675b99fe36","analyzedAt":"2026-08-07T00:29:34.215Z","schemaVersion":2},"datasetVersion":"2026-08-07T03:17:09.362Z"}