{"record":{"id":"f52d0df400b5739a","repo":"grafana/k6","slug":"route-is-already-handled","errorCode":null,"errorMessage":"route is already handled","messagePattern":"route is already handled","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/common/http.go","lineNumber":908,"sourceCode":"\t\treturn err\n\t}\n\n\treturn r.networkManager.ContinueRequest(r.request.interceptionID, opts, r.request.HeadersArray())\n}\n\n// Fulfill fulfills the request with the given options for the response.\nfunc (r *Route) Fulfill(opts FulfillOptions) error {\n\terr := r.startHandling()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn r.networkManager.FulfillRequest(r.request, opts)\n}\n\nfunc (r *Route) startHandling() error {\n\tif r.handled {\n\t\treturn fmt.Errorf(\"route is already handled\")\n\t}\n\tr.handled = true\n\treturn nil\n}\n","sourceCodeStart":890,"sourceCodeEnd":913,"githubUrl":"https://github.com/grafana/k6/blob/8d06114777191d21ef885d05c5f8aa9e1ed838ae/internal/js/modules/k6/browser/common/http.go#L890-L913","documentation":"Single-use guard in Route.startHandling: each intercepted request route can be completed exactly once, and a boolean \"handled\" flag is flipped on the first fulfill/abort/continue call. This error is returned when a second completion is attempted on the same Route — e.g., script logic calls both route.fulfill() and route.continue(), or an abort/continue race after a timeout handler already fulfilled.","triggerScenarios":"Thrown at internal/js/modules/k6/browser/common/http.go:909 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Call exactly one of route.fulfill(), route.abort(), or route.continue() per intercepted request","Return early from the handler after the first completion call","Clear any timers (setTimeout fallbacks) that may complete the route after the main handler already did"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8d06114777191d21ef885d05c5f8aa9e1ed838ae","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":"2026-08-18T03:05:52.393Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}