{"record":{"id":"06ad44cd84090a48","repo":"grafana/k6","slug":"invalid-batch-request-v","errorCode":null,"errorMessage":"invalid batch request '%#v'","messagePattern":"invalid batch request '%#v'","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"js/modules/k6/http/request.go","lineNumber":562,"sourceCode":"\t}\n\treturn results, err\n}\n\nfunc (c *Client) parseBatchRequest(key any, val any) (*httpext.ParsedHTTPRequest, error) {\n\tvar (\n\t\tmethod       = http.MethodGet\n\t\tok           bool\n\t\tbody, reqURL any\n\t\tparams       sobek.Value\n\t\trt           = c.moduleInstance.vu.Runtime()\n\t)\n\n\tswitch data := val.(type) {\n\tcase []any:\n\t\t// Handling of [\"GET\", \"http://example.com/\"]\n\t\tdataLen := len(data)\n\t\tif dataLen < 2 {\n\t\t\treturn nil, fmt.Errorf(\"invalid batch request '%#v'\", data)\n\t\t}\n\t\tmethod, ok = data[0].(string)\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"invalid method type '%#v'\", data[0])\n\t\t}\n\t\treqURL = data[1]\n\t\tif dataLen > 2 {\n\t\t\tbody = data[2]\n\t\t}\n\t\tif dataLen > 3 {\n\t\t\tparams = rt.ToValue(data[3])\n\t\t}\n\n\tcase map[string]any:\n\t\t// Handling of {method: \"GET\", url: \"https://test.k6.io\"}\n\t\tif _, ok := data[\"url\"]; !ok {\n\t\t\treturn nil, fmt.Errorf(\"batch request %v doesn't have a url key\", key)\n\t\t}","sourceCodeStart":544,"sourceCodeEnd":580,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/js/modules/k6/http/request.go#L544-L580","documentation":"A batch entry used the short array form (e.g. ['GET','http://example.com/']) but has fewer than two elements, so method and URL cannot both be extracted. parseBatchRequest rejects the malformed request array.","triggerScenarios":"Thrown at js/modules/k6/http/request.go:562 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Include at least method and URL in array-form entries: ['POST', 'http://example.com/', 'body']","Or use the string shorthand: 'http://example.com/'"],"exampleFix":null,"handlingStrategy":"validation","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"}