{"record":{"id":"e758aa1d1cff4b84","repo":"grafana/k6","slug":"invalid-maxreceivesize-value-v-it-needs-to-b","errorCode":null,"errorMessage":"invalid maxReceiveSize value: '%#v', it needs to be an integer","messagePattern":"invalid maxReceiveSize value: '%#v', it needs to be an integer","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/grpc/params.go","lineNumber":188,"sourceCode":"\t\t\t}\n\t\tcase \"reflect\":\n\t\t\tvar ok bool\n\t\t\tresult.UseReflectionProtocol, ok = v.(bool)\n\t\t\tif !ok {\n\t\t\t\treturn result, fmt.Errorf(\"invalid reflect value: '%#v', it needs to be boolean\", v)\n\t\t\t}\n\t\tcase \"reflectMetadata\":\n\t\t\tmd, err := newMetadata(params.Get(k))\n\t\t\tif err != nil {\n\t\t\t\treturn result, fmt.Errorf(\"invalid reflectMetadata param: %w\", err)\n\t\t\t}\n\n\t\t\tresult.ReflectionMetadata = md\n\t\tcase \"maxReceiveSize\":\n\t\t\tvar ok bool\n\t\t\tresult.MaxReceiveSize, ok = v.(int64)\n\t\t\tif !ok {\n\t\t\t\treturn result, fmt.Errorf(\"invalid maxReceiveSize value: '%#v', it needs to be an integer\", v)\n\t\t\t}\n\t\t\tif result.MaxReceiveSize < 0 {\n\t\t\t\treturn result, fmt.Errorf(\"invalid maxReceiveSize value: '%#v, it needs to be a positive integer\", v)\n\t\t\t}\n\t\tcase \"maxSendSize\":\n\t\t\tvar ok bool\n\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\":","sourceCodeStart":170,"sourceCodeEnd":206,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/js/modules/k6/grpc/params.go#L170-L206","documentation":"maxReceiveSize in client.connect() params caps the message size in bytes the client accepts and must be an integer (a JS number that exports to int64); 0 keeps the default (no explicit limit, params.go:142). Strings ('1024') and non-integer numbers (1024.5) fail the type assertion and throw 'invalid maxReceiveSize value ... needs to be an integer'.","triggerScenarios":"connect(addr, { maxReceiveSize: '4194304' }); { maxReceiveSize: 3.5 }; values read from JSON/YAML config that were quoted.","commonSituations":"Config systems that stringify numbers; unit confusion (the value is raw bytes, not KB); raising limits to accommodate large response payloads.","solutions":["Pass an integer number of bytes: 4194304","parseInt env/config strings before passing","Remember 0 means no explicit limit"],"exampleFix":"// before\nclient.connect(addr, { maxReceiveSize: '4194304' });\n\n// after\nclient.connect(addr, { maxReceiveSize: 4194304 });","handlingStrategy":"validation","validationCode":"if (connectParams.maxReceiveSize !== undefined &&\n    !(typeof connectParams.maxReceiveSize === 'number' && Number.isInteger(connectParams.maxReceiveSize))) {\n  throw new Error(`maxReceiveSize must be an integer, got ${connectParams.maxReceiveSize}`);\n}\nclient.connect(addr, connectParams);","typeGuard":"function isByteSize(v) {\n  return typeof v === 'number' && Number.isInteger(v) && v >= 0;\n}","tryCatchPattern":null,"preventionTips":["Pass raw byte counts as integer literals","parseInt size strings from config before passing","Remember 0 means no explicit limit"],"tags":["grpc","connect","size-limits","type-error"],"backgroundTag":null,"analyzedSha":"93accf6570dcd306ca5e99cc44c393ee3797761b","analyzedAt":"2026-08-15T21:23:27.118Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}