{"record":{"id":"c8dff9e6d58919d0","repo":"grafana/k6","slug":"unknown-connect-param-q","errorCode":null,"errorMessage":"unknown connect param: %q","messagePattern":"unknown connect param: %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/grpc/params.go","lineNumber":213,"sourceCode":"\t\t\tresult.MaxSendSize, ok = v.(int64)\n\t\t\tif !ok {\n\t\t\t\treturn result, fmt.Errorf(\"invalid maxSendSize value: '%#v', it needs to be an integer\", v)\n\t\t\t}\n\t\t\tif result.MaxSendSize < 0 {\n\t\t\t\treturn result, fmt.Errorf(\"invalid maxSendSize value: '%#v, it needs to be a positive integer\", v)\n\t\t\t}\n\t\tcase \"tls\":\n\t\t\tif err := parseConnectTLSParam(result, v); err != nil {\n\t\t\t\treturn result, err\n\t\t\t}\n\t\tcase \"authority\":\n\t\t\tvar ok bool\n\t\t\tresult.Authority, ok = v.(string)\n\t\t\tif !ok {\n\t\t\t\treturn result, fmt.Errorf(\"invalid authority value: '%#v', it needs to be a string\", v)\n\t\t\t}\n\t\tdefault:\n\t\t\treturn result, fmt.Errorf(\"unknown connect param: %q\", k)\n\t\t}\n\t}\n\n\treturn result, nil\n}\n\nfunc parseConnectTLSParam(params *connectParams, v any) error {\n\tvar ok bool\n\tparams.TLS, ok = v.(map[string]any)\n\n\tif !ok {\n\t\treturn fmt.Errorf(\"invalid tls value: '%#v', expected (optional) keys: cert, key, password, and cacerts\", v)\n\t}\n\t// optional map keys below\n\tif cert, certok := params.TLS[\"cert\"]; certok {\n\t\tif _, ok = cert.(string); !ok {\n\t\t\treturn fmt.Errorf(\"invalid tls cert value: '%#v', it needs to be a PEM formatted string\", v)\n\t\t}","sourceCodeStart":195,"sourceCodeEnd":231,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/js/modules/k6/grpc/params.go#L195-L231","documentation":"Thrown by k6's gRPC Client.connect() when the params object contains a key that is not one of the recognized connect options. The parser in newConnectParams (internal/js/modules/k6/grpc/params.go:155-214) iterates every key of the object passed to connect() and only accepts: plaintext, timeout, reflect, reflectMetadata, maxReceiveSize, maxSendSize, tls, authority. Any other key hits the default branch and fails the whole connect call, so the error is a strict schema check, not a runtime/network problem.","triggerScenarios":"Calling client.connect('host:port', { ... }) with a misspelled or unsupported option, e.g. { TLS: {...} } (uppercase), { timeouts: '5s' }, { userAgent: 'x' }, or copy-pasting an option that belongs to call params (metadata, tags, discardResponseMessage) into the connect options object.","commonSituations":"Porting a script from k6/http where option names differ; using a TLS key spelled 'TLS' instead of 'tls'; copying connect options from an older k6 example or another tool; adding call-level params (like 'metadata') to connect() instead of to client.invoke()/client.newStream().","solutions":["Check the exact key name reported between the quotes in the message against the allowed list: plaintext, timeout, reflect, reflectMetadata, maxReceiveSize, maxSendSize, tls, authority.","Remove the offending key from the object passed to client.connect(); if it is a call-level option (metadata, tags, timeout, discardResponseMessage), move it to the second argument of client.invoke() or client.newStream().","Fix casing/typos, e.g. 'TLS' -> 'tls', 'reflectmetadata' -> 'reflectMetadata'.","If you expected the option to exist, verify your k6 version's gRPC module documentation — the supported set is fixed by newConnectParams."],"exampleFix":"// before\nclient.connect('grpc.example.com:443', {\n  timeout: '5s',\n  TLS: { cacerts: [ca] }, // unknown connect param: \"TLS\"\n});\n\n// after\nclient.connect('grpc.example.com:443', {\n  timeout: '5s',\n  tls: { cacerts: [ca] },\n});","handlingStrategy":"validation","validationCode":"const CONNECT_KEYS = new Set(['plaintext', 'timeout', 'reflect', 'reflectMetadata', 'maxReceiveSize', 'maxSendSize', 'tls', 'authority']);\nfunction validateConnectParams(params = {}) {\n  const unknown = Object.keys(params).filter((k) => !CONNECT_KEYS.has(k));\n  if (unknown.length) {\n    throw new Error(`unsupported connect option(s): ${unknown.join(', ')}; allowed: ${[...CONNECT_KEYS].join(', ')}`);\n  }\n}","typeGuard":"function isConnectParams(p) {\n  return p == null || (typeof p === 'object' && Object.keys(p).every((k) => ['plaintext', 'timeout', 'reflect', 'reflectMetadata', 'maxReceiveSize', 'maxSendSize', 'tls', 'authority'].includes(k)));\n}","tryCatchPattern":"try { client.connect(addr, params); } catch (e) { if (/unknown connect param/.test(e.message)) { /* strip bad keys and retry or fail fast with context */ } throw e; }","preventionTips":["Keep connect options in a single shared, reviewed constant instead of inline literals.","Add a smoke-test scenario in CI that runs the connect step so unknown keys fail the build, not production."],"tags":["grpc","validation","config","connect"],"backgroundTag":null,"analyzedSha":"93accf6570dcd306ca5e99cc44c393ee3797761b","analyzedAt":"2026-08-15T21:23:27.118Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}