{"record":{"id":"718d0e00b619dc7d","repo":"grafana/k6","slug":"invalid-grpc-stream-s-client-w","errorCode":null,"errorMessage":"invalid GRPC Stream's client: %w","messagePattern":"invalid GRPC Stream's client: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/grpc/grpc.go","lineNumber":117,"sourceCode":"\tmustAddServingStatus(\"HealthCheckServing\", healthpb.HealthCheckResponse_SERVING)\n\tmustAddServingStatus(\"HealthCheckNotServing\", healthpb.HealthCheckResponse_NOT_SERVING)\n\tmustAddServingStatus(\"HealthCheckServiceUnkown\", healthpb.HealthCheckResponse_SERVICE_UNKNOWN)\n}\n\n// Exports returns the exports of the grpc module.\nfunc (mi *ModuleInstance) Exports() modules.Exports {\n\treturn modules.Exports{\n\t\tNamed: mi.exports,\n\t}\n}\n\n// stream returns a new stream object\nfunc (mi *ModuleInstance) stream(c sobek.ConstructorCall) *sobek.Object {\n\trt := mi.vu.Runtime()\n\n\tclient, err := extractClient(c.Argument(0), rt)\n\tif err != nil {\n\t\tcommon.Throw(rt, fmt.Errorf(\"invalid GRPC Stream's client: %w\", err))\n\t}\n\n\tmethodName := sanitizeMethodName(c.Argument(1).String())\n\tmethodDescriptor, err := client.getMethodDescriptor(methodName)\n\tif err != nil {\n\t\tcommon.Throw(rt, fmt.Errorf(\"invalid GRPC Stream's method: %w\", err))\n\t}\n\n\tp, err := newCallParams(mi.vu, c.Argument(2))\n\tif err != nil {\n\t\tcommon.Throw(rt, fmt.Errorf(\"invalid GRPC Stream's parameters: %w\", err))\n\t}\n\n\tp.SetSystemTags(mi.vu.State(), client.addr, methodName)\n\n\tlogger := mi.vu.State().Logger.WithField(\"streamMethod\", methodName)\n\n\ts := &stream{","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/js/modules/k6/grpc/grpc.go#L99-L135","documentation":"Raised in the grpc module's stream constructor when extractClient cannot interpret the first argument as a connected grpc.Client — wrong type, uninitialized client, or a client that failed construction. Thrown via common.Throw.","triggerScenarios":"Thrown at internal/js/modules/k6/grpc/grpc.go:117 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a grpc.Client instance created with new grpc.Client() as the first argument","Ensure the client is fully constructed before instantiating grpc.Stream"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ffac6f245854c1b8adc6a69857c76a15f90022","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":"2026-08-18T03:05:52.393Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}