{"record":{"id":"e5c11be4276aa127","repo":"apify/crawlee","slug":"intercept-request-handler-must-call-one-of-request","errorCode":null,"errorMessage":"Intercept request handler must call one of request.continue|respond|abort() methods!","messagePattern":"Intercept request handler must call one of request\\.continue\\|respond\\|abort\\(\\) methods!","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/puppeteer-crawler/src/internals/utils/puppeteer_request_interception.ts","lineNumber":103,"sourceCode":"    };\n\n    const { abort, respond } = request;\n    request.abort = async (...args) => {\n        wasAborted = true;\n        return abort.call(request, ...args);\n    };\n    request.respond = async (...args) => {\n        wasResponded = true;\n        return respond.call(request, ...args);\n    };\n\n    for (const handler of interceptRequestHandlers) {\n        wasContinued = false;\n\n        await handler(request);\n        // Check that one of the functions was called.\n        if (!wasAborted && !wasResponded && !wasContinued) {\n            throw new Error('Intercept request handler must call one of request.continue|respond|abort() methods!');\n        }\n\n        // If request was aborted or responded then we can finish immediately.\n        if (wasAborted || wasResponded) return undefined;\n    }\n\n    return originalContinue(accumulatedOverrides);\n}\n\n/**\n * Adds request interception handler in similar to `page.on('request', handler);` but in addition to that\n * supports multiple parallel handlers.\n *\n * All the handlers are executed sequentially in the order as they were added.\n * Each of the handlers must call one of `request.continue()`, `request.abort()` and `request.respond()`.\n * In addition to that any of the handlers may modify the request object (method, postData, headers)\n * by passing its overrides to `request.continue()`.\n * If multiple handlers modify same property then the last one wins. Headers are merged separately so you can","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/apify/crawlee/blob/dbe57fb09ca607ad59dcf998f3925ef9ac3bb26c/packages/puppeteer-crawler/src/internals/utils/puppeteer_request_interception.ts#L85-L121","documentation":"Puppeteer request interception requires each intercept request handler to resolve the request by calling request.continue(), request.respond(), or request.abort(). The utility wraps these calls to set wasContinued/wasResponded/wasAborted flags; if a handler returns without invoking any of them, this error is thrown because the request would otherwise hang.","triggerScenarios":"Registering a handler via utils.puppeteerRequestInterception / interceptRequestManager whose callback neither continues, responds to, nor aborts the request — e.g., only logging the request URL or conditionally calling continue() on paths that don't always execute.","commonSituations":"Handlers with early `return` statements before continue(); try/catch swallowing the continue() call on error; copying handlers that only inspect requests; forgetting continue() in the default branch of an if/else chain.","solutions":["Ensure every code path in the handler ends with exactly one of request.continue(), request.respond(), or request.abort().","Add a fallback `else { await request.continue(); }` for conditional logic.","Use continueRequest/respondWith/abortRequest helpers from playwright-utils-style wrappers which set the flags correctly."],"exampleFix":"// before\nconst handler = async (request) => {\n    if (request.url().endsWith('.png')) {\n        await request.abort();\n    }\n    // images and everything else: nothing called -> error\n};\n// after\nconst handler = async (request) => {\n    if (request.url().endsWith('.png')) {\n        await request.abort();\n    } else {\n        await request.continue();\n    }\n};","handlingStrategy":"validation","validationCode":"// static check: ensure handler ends with a resolution call\nfunction assertHandlerResolves(src: string) {\n    if (!/request\\.(continue|respond|abort)\\s*\\(/.test(src)) {\n        throw new Error('Intercept handler must call continue/respond/abort');\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    await handler(request);\n} catch (err) {\n    if (err.message.includes('must call one of request.continue|respond|abort')) {\n        log.error(`Handler for ${request.url()} did not resolve the request`);\n    }\n    throw err;\n}","preventionTips":["Every branch of an interception handler must end in continue(), respond(), or abort().","Add a default `await request.continue()` fallback at the end of handlers.","Lint handlers for early returns preceding resolution calls."],"tags":["request-interception","puppeteer","handler-contract","crawlee"],"backgroundTag":"intercept-handler-no-resolution","analyzedSha":"dbe57fb09ca607ad59dcf998f3925ef9ac3bb26c","analyzedAt":"2026-08-30T22:22:28.328Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}