{"record":{"id":"1384cd437f7d0aed","repo":"grafana/k6","slug":"batch-request-v-doesn-t-have-a-url-key","errorCode":null,"errorMessage":"batch request %v doesn't have a url key","messagePattern":"batch request (.+?) doesn't have a url key","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"js/modules/k6/http/request.go","lineNumber":579,"sourceCode":"\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}\n\n\t\treqURL = data[\"url\"]\n\t\tbody = data[\"body\"] // It's fine if it's missing, the map lookup will return\n\n\t\tif newMethod, ok := data[\"method\"]; ok {\n\t\t\tif method, ok = newMethod.(string); !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"invalid method type '%#v'\", newMethod)\n\t\t\t}\n\t\t\tmethod = strings.ToUpper(method)\n\t\t\tif method == http.MethodGet || method == http.MethodHead {\n\t\t\t\tbody = nil\n\t\t\t}\n\t\t}\n\n\t\tif p, ok := data[\"params\"]; ok {\n\t\t\tparams = rt.ToValue(p)\n\t\t}","sourceCodeStart":561,"sourceCodeEnd":597,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/js/modules/k6/http/request.go#L561-L597","documentation":"An object-form entry in the batch requests (keyed by 'key' in the error) is missing its required 'url' property. parseBatchRequest looks up data[\"url\"] in the map and refuses entries without it; method, body and params are all optional, only url is mandatory.","triggerScenarios":"Thrown at js/modules/k6/http/request.go:579 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add a url property to every object-form entry in the http.batch() array","Verify the property is spelled exactly 'url' and is not nested inside another object"],"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"}