{"record":{"id":"2a87400f84da6ac1","repo":"grpc/grpc-go","slug":"lrs-invalid-load-reporting-interval-v","errorCode":null,"errorMessage":"lrs: invalid load_reporting_interval: %v","messagePattern":"lrs: invalid load_reporting_interval: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/xds/clients/lrsclient/lrs_stream.go","lineNumber":222,"sourceCode":"func (lrs *streamImpl) recvFirstLoadStatsResponse(stream clients.Stream) ([]string, time.Duration, error) {\n\tr, err := stream.Recv()\n\tif err != nil {\n\t\treturn nil, 0, fmt.Errorf(\"lrs: failed to receive first LoadStatsResponse: %v\", err)\n\t}\n\tvar resp v3lrspb.LoadStatsResponse\n\tif err := proto.Unmarshal(r, &resp); err != nil {\n\t\tif lrs.logger.V(2) {\n\t\t\tlrs.logger.Infof(\"Failed to unmarshal response to LoadStatsResponse: %v\", err)\n\t\t}\n\t\treturn nil, time.Duration(0), fmt.Errorf(\"lrs: unexpected message type %T\", r)\n\t}\n\tif lrs.logger.V(perRPCVerbosityLevel) {\n\t\tlrs.logger.Infof(\"Received first LoadStatsResponse: %s\", pretty.ToJSON(&resp))\n\t}\n\n\tinternal := resp.GetLoadReportingInterval()\n\tif internal.CheckValid() != nil {\n\t\treturn nil, 0, fmt.Errorf(\"lrs: invalid load_reporting_interval: %v\", err)\n\t}\n\tloadReportingInterval := internal.AsDuration()\n\n\tclusters := resp.Clusters\n\tif resp.SendAllClusters {\n\t\t// Return an empty slice to send stats for all clusters.\n\t\tclusters = []string{}\n\t}\n\n\treturn clusters, loadReportingInterval, nil\n}\n\nfunc (lrs *streamImpl) sendLoadStatsRequest(stream clients.Stream, loads []*loadData) error {\n\tclusterStats := make([]*v3endpointpb.ClusterStats, 0, len(loads))\n\tfor _, sd := range loads {\n\t\tdroppedReqs := make([]*v3endpointpb.ClusterStats_DroppedRequests, 0, len(sd.drops))\n\t\tfor category, count := range sd.drops {\n\t\t\tdroppedReqs = append(droppedReqs, &v3endpointpb.ClusterStats_DroppedRequests{","sourceCodeStart":204,"sourceCodeEnd":240,"githubUrl":"https://github.com/grpc/grpc-go/blob/03255a9237b6eb32710f6bc4f2de9a675b99fe36/internal/xds/clients/lrsclient/lrs_stream.go#L204-L240","documentation":"Returned when the first LoadStatsResponse unmarshals fine but resp.GetLoadReportingInterval().CheckValid() reports the duration as invalid (e.g. missing, negative seconds, or out-of-range). Note the message formats the stale `err` variable (nil at this point) rather than the CheckValid cause, which is a code defect, but the trigger is genuinely an invalid interval field from the server.","triggerScenarios":"An LRS server sends a LoadStatsResponse whose load_reporting_interval is unset, negative, or has an overflow; the client rejects it before entering the periodic sendLoads loop.","commonSituations":"Misconfigured or buggy control plane that omits load_reporting_interval, a custom LRS server returning a zero/negative duration, or a proto version skew where the field encoding differs.","solutions":["Inspect the actual LoadStatsResponse the server emits (grpcurl / server logs) and confirm load_reporting_interval is a positive, valid duration.","Fix the server-side LRS configuration to always set load_reporting_interval (Envoy/traffic-director normally send e.g. 10s/60s).","If you control the server, ensure the duration is serialized via durationpb.New with a non-negative time.Duration."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Ensure the LRS server always sets a positive load_reporting_interval.","Test the server's LRS response shape with grpcurl before client integration.","Report the stale-err formatting defect upstream; the trigger itself is a server config issue."],"tags":["grpc","xds","lrs","config","duration"],"analyzedSha":"03255a9237b6eb32710f6bc4f2de9a675b99fe36","analyzedAt":"2026-08-07T00:29:34.215Z","schemaVersion":2},"datasetVersion":"2026-08-07T03:17:09.362Z"}