{"record":{"id":"4401b399b2cd9c84","repo":"grafana/k6","slug":"invalid-grpc-connect-parameters-w","errorCode":null,"errorMessage":"invalid grpc.connect() parameters: %w","messagePattern":"invalid grpc\\.connect\\(\\) parameters: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/grpc/client.go","lineNumber":257,"sourceCode":"// fetcher through lib.State.\nfunc buildTLSConfigForConnect(parent *tls.Config, tlsMap map[string]any, state *lib.State) (*tls.Config, error) {\n\tvar aiaFetcher *netext.AIAFetcher\n\tif state.Options.TLSAIAFetch.Bool {\n\t\taiaFetcher = netext.NewAIAFetcher(state.Dialer.DialContext)\n\t}\n\treturn buildTLSConfigFromMap(parent, tlsMap, aiaFetcher, state.Options.InsecureSkipTLSVerify.Bool, state.Logger)\n}\n\n// Connect is a block dial to the gRPC server at the given address (host:port)\nfunc (c *Client) Connect(addr string, params sobek.Value) (bool, error) {\n\tstate := c.vu.State()\n\tif state == nil {\n\t\treturn false, common.NewInitContextError(\"connecting to a gRPC server in the init context is not supported\")\n\t}\n\n\tp, err := newConnectParams(c.vu, params)\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"invalid grpc.connect() parameters: %w\", err)\n\t}\n\n\topts := grpcext.DefaultOptions(c.vu.State)\n\n\tvar tcred credentials.TransportCredentials\n\tif !p.IsPlaintext {\n\t\ttlsCfg := state.TLSConfig.Clone()\n\t\tif len(p.TLS) > 0 {\n\t\t\ttlsCfg, err = buildTLSConfigForConnect(tlsCfg, p.TLS, state)\n\t\t\tif err != nil {\n\t\t\t\treturn false, err\n\t\t\t}\n\t\t}\n\t\ttlsCfg.NextProtos = []string{\"h2\"}\n\n\t\ttcred = credentials.NewTLS(tlsCfg)\n\t} else {\n\t\ttcred = insecure.NewCredentials()","sourceCodeStart":239,"sourceCodeEnd":275,"githubUrl":"https://github.com/grafana/k6/blob/8d06114777191d21ef885d05c5f8aa9e1ed838ae/internal/js/modules/k6/grpc/client.go#L239-L275","documentation":"Raised in Client.Connect when newConnectParams fails to interpret the params object passed to grpc.connect — an invalid value for one of the connect options (plaintext, timeout, tls, authority, etc.; the wrapped error names which).","triggerScenarios":"Thrown at internal/js/modules/k6/grpc/client.go:227 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Read the wrapped error to identify the offending connect option","Use correct types: booleans for plaintext/reflect, duration strings or ms integers for timeout, string for authority","Remove unrecognized keys from the params object"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8d06114777191d21ef885d05c5f8aa9e1ed838ae","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":"2026-08-18T03:05:52.393Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}