{"record":{"id":"a63e0f2e76d0882b","repo":"grafana/k6","slug":"method-q-is-invalid","errorCode":null,"errorMessage":"method %q is invalid","messagePattern":"method %q is invalid","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/common/page.go","lineNumber":458,"sourceCode":"\n// Tag will find the first match given the URLTagPatterns and the URL from\n// the metric tag and update the name field.\nfunc (e *MetricEvent) Tag(rm RegExMatcher, matches TagMatches) error {\n\tname := strings.TrimSpace(matches.TagName)\n\tif name == \"\" {\n\t\treturn fmt.Errorf(\"name %q is invalid\", matches.TagName)\n\t}\n\n\tfor _, m := range matches.Matches {\n\t\t// Validate the request method type if it has been assigned in a Match.\n\t\tmethod := strings.TrimSpace(m.Method)\n\t\tif method != \"\" {\n\t\t\tmethod = strings.ToUpper(method)\n\t\t\tswitch method {\n\t\t\tcase http.MethodGet, http.MethodPost, http.MethodPut, http.MethodDelete, http.MethodPatch,\n\t\t\t\thttp.MethodHead, http.MethodOptions, http.MethodConnect, http.MethodTrace:\n\t\t\tdefault:\n\t\t\t\treturn fmt.Errorf(\"method %q is invalid\", m.Method)\n\t\t\t}\n\n\t\t\tif method != e.method {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\t// matchesRegex is a function that will perform the regex test in the Sobek\n\t\t// runtime.\n\t\tmatched, err := rm(m.URLRegEx, e.url)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif matched {\n\t\t\te.isUserURLTagNameExist = true\n\t\t\te.userProvidedURLTagName = name\n\t\t\treturn nil","sourceCodeStart":440,"sourceCodeEnd":476,"githubUrl":"https://github.com/grafana/k6/blob/3fcf5388d78cb382f0c0d42ec556a06bfd1b8dee/internal/js/modules/k6/browser/common/page.go#L440-L476","documentation":"Validation guard in MetricEvent.Tag: a Match entry's method field (uppercased after trimming) is not one of the accepted HTTP verbs (GET, POST, PUT, etc.). The offending input is the 'method' value inside a metricEventPatterns match.","triggerScenarios":"Thrown at internal/js/modules/k6/browser/common/page.go:456 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a standard HTTP method name in the match's method field","Leave method empty to match all methods","Correct typos and casing is flexible but the name must be a real verb"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3fcf5388d78cb382f0c0d42ec556a06bfd1b8dee","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":"2026-08-18T03:05:52.393Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}