{"record":{"id":"0cb54d7d86364443","repo":"grafana/k6","slug":"fail-to-fulfill-request-id-s-w","errorCode":null,"errorMessage":"fail to fulfill request (id: %s): %w","messagePattern":"fail to fulfill request \\(id: (.+?)\\): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/common/network_manager.go","lineNumber":1013,"sourceCode":"\tif len(headers) > 0 {\n\t\taction = action.WithResponseHeaders(headers)\n\t}\n\n\tif len(opts.Body) > 0 {\n\t\tb64Body := base64.StdEncoding.EncodeToString(opts.Body)\n\t\taction = action.WithBody(b64Body)\n\t}\n\n\tif err := action.Do(cdp.WithExecutor(m.ctx, m.session)); err != nil {\n\t\t// Avoid logging as error when context is canceled.\n\t\t// Most probably this happens when trying to fail a site's background request\n\t\t// while the iteration is ending and therefore the browser context is being closed.\n\t\tif errors.Is(err, context.Canceled) {\n\t\t\tm.logger.Debug(\"NetworkManager:FulfillRequest\", \"context canceled fulfilling request\")\n\t\t\treturn nil\n\t\t}\n\n\t\treturn fmt.Errorf(\"fail to fulfill request (id: %s): %w\",\n\t\t\trequest.interceptionID, err)\n\t}\n\n\treturn nil\n}\n\nfunc toFetchHeaders(headers []HTTPHeader) []*fetch.HeaderEntry {\n\tif len(headers) == 0 {\n\t\treturn nil\n\t}\n\n\tfetchHeaders := make([]*fetch.HeaderEntry, len(headers))\n\tfor i, header := range headers {\n\t\tfetchHeaders[i] = &fetch.HeaderEntry{\n\t\t\tName:  header.Name,\n\t\t\tValue: header.Value,\n\t\t}\n\t}","sourceCodeStart":995,"sourceCodeEnd":1031,"githubUrl":"https://github.com/grafana/k6/blob/8d06114777191d21ef885d05c5f8aa9e1ed838ae/internal/js/modules/k6/browser/common/network_manager.go#L995-L1031","documentation":"Failure of the CDP Fetch.fulfillRequest command while serving a mocked response (with optional headers and base64 body) for the identified request. Context-canceled failures during teardown are swallowed; other causes are typically the request already being done or the target navigating away.","triggerScenarios":"Thrown at internal/js/modules/k6/browser/common/network_manager.go:1013 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fulfill intercepted requests promptly in the route handler","Ensure response body/status provided are valid and the request is still paused","Ignore failures that coincide with page navigation or iteration end"],"exampleFix":null,"handlingStrategy":"try-catch","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"}