apify/crawlee · error

Intercept request handler must call one of request.continue|

Error message

Intercept request handler must call one of request.continue|respond|abort() methods!

What it means

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.

Source

Thrown at packages/puppeteer-crawler/src/internals/utils/puppeteer_request_interception.ts:103

    };

    const { abort, respond } = request;
    request.abort = async (...args) => {
        wasAborted = true;
        return abort.call(request, ...args);
    };
    request.respond = async (...args) => {
        wasResponded = true;
        return respond.call(request, ...args);
    };

    for (const handler of interceptRequestHandlers) {
        wasContinued = false;

        await handler(request);
        // Check that one of the functions was called.
        if (!wasAborted && !wasResponded && !wasContinued) {
            throw new Error('Intercept request handler must call one of request.continue|respond|abort() methods!');
        }

        // If request was aborted or responded then we can finish immediately.
        if (wasAborted || wasResponded) return undefined;
    }

    return originalContinue(accumulatedOverrides);
}

/**
 * Adds request interception handler in similar to `page.on('request', handler);` but in addition to that
 * supports multiple parallel handlers.
 *
 * All the handlers are executed sequentially in the order as they were added.
 * Each of the handlers must call one of `request.continue()`, `request.abort()` and `request.respond()`.
 * In addition to that any of the handlers may modify the request object (method, postData, headers)
 * by passing its overrides to `request.continue()`.
 * If multiple handlers modify same property then the last one wins. Headers are merged separately so you can

View on GitHub (pinned to dbe57fb09c)

Solutions

  1. Ensure every code path in the handler ends with exactly one of request.continue(), request.respond(), or request.abort().
  2. Add a fallback `else { await request.continue(); }` for conditional logic.
  3. Use continueRequest/respondWith/abortRequest helpers from playwright-utils-style wrappers which set the flags correctly.

Example fix

// before
const handler = async (request) => {
    if (request.url().endsWith('.png')) {
        await request.abort();
    }
    // images and everything else: nothing called -> error
};
// after
const handler = async (request) => {
    if (request.url().endsWith('.png')) {
        await request.abort();
    } else {
        await request.continue();
    }
};
Defensive patterns

Strategy: validation

Validate before calling

// static check: ensure handler ends with a resolution call
function assertHandlerResolves(src: string) {
    if (!/request\.(continue|respond|abort)\s*\(/.test(src)) {
        throw new Error('Intercept handler must call continue/respond/abort');
    }
}

Try / catch

try {
    await handler(request);
} catch (err) {
    if (err.message.includes('must call one of request.continue|respond|abort')) {
        log.error(`Handler for ${request.url()} did not resolve the request`);
    }
    throw err;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of apify/crawlee@dbe57fb09c (2026-08-30). Data as JSON: /api/errors/e5c11be4276aa127. Report an issue: GitHub.