{"record":{"id":"bc378d0d61cb25c5","repo":"grafana/k6","slug":"unknown-request-body-type-t","errorCode":null,"errorMessage":"unknown request body type %T","messagePattern":"unknown request body type %T","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"js/modules/k6/http/request.go","lineNumber":305,"sourceCode":"\t\t\tnewData := map[string]any{}\n\t\t\tfor k, v := range data {\n\t\t\t\tnewData[k] = v.Export()\n\t\t\t}\n\t\t\tif err := handleObjectBody(newData); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\tcase sobek.ArrayBuffer:\n\t\t\tresult.Body = bytes.NewBuffer(data.Bytes())\n\t\tcase map[string]any:\n\t\t\tif err := handleObjectBody(data); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\tcase string:\n\t\t\tresult.Body = bytes.NewBufferString(data)\n\t\tcase []byte:\n\t\t\tresult.Body = bytes.NewBuffer(data)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unknown request body type %T\", body)\n\t\t}\n\t}\n\n\tresult.Req.Header.Set(\"User-Agent\", state.Options.UserAgent.String)\n\n\tif state.CookieJar != nil {\n\t\tresult.ActiveJar = state.CookieJar\n\t}\n\n\t// TODO: ditch sobek.Value, reflections and Object and use a simple go map and type assertions?\n\t//nolint: nestif\n\tif !common.IsNullish(params) {\n\t\tparams := params.ToObject(rt)\n\t\tfor _, k := range params.Keys() {\n\t\t\tswitch k {\n\t\t\tcase \"cookies\":\n\t\t\t\tcookiesV := params.Get(k)\n\t\t\t\tif common.IsNullish(cookiesV) {","sourceCodeStart":287,"sourceCodeEnd":323,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/js/modules/k6/http/request.go#L287-L323","documentation":"parseRequest's type switch on the request body fell through to the default branch: the supplied body is none of string, []byte, ArrayBuffer, object (form data) or exported object map. The actual Go type is named.","triggerScenarios":"Thrown at js/modules/k6/http/request.go:305 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a string, object (form-encoded), ArrayBuffer or binary data as the request body","Convert numbers/other types to a string before passing them as data"],"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":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}