apify/crawlee · error · Error
The `response` property is not available. This might mean th
Error message
The `response` property is not available. This might mean that you're trying to access it before navigation or that navigation resulted in `null` (this should only happen with `about:` URLs)
What it means
In the pre-navigation phase of the crawling context, the `response` property has no value yet. Accessing it before navigation completes (or when navigation yields null, e.g. for `about:` URLs) throws this error rather than returning undefined, to surface lifecycle mistakes clearly.
Source
Thrown at packages/browser-crawler/src/internals/browser-crawler.ts:606
id: crawlingContext.id,
session: crawlingContext.session,
});
tryCancel();
const addRequests = crawlingContext.addRequests;
const extractLinks = async (options?: ExtractLinksOptions): Promise<string[]> => {
return extractUrlsFromPage(
page as any,
options?.selector ?? 'a',
options?.baseUrl ?? crawlingContext.request.loadedUrl ?? crawlingContext.request.url,
);
};
return {
page,
get response(): Response {
throw new Error(
"The `response` property is not available. This might mean that you're trying to access it before navigation or that navigation resulted in `null` (this should only happen with `about:` URLs)",
);
},
get gotoOptions(): Dictionary {
throw new Error('The `gotoOptions` property is not available until `prepareNavigation` runs.');
},
extractLinks,
enqueueLinks: async (options: EnqueueLinksOptions = {}) => {
const baseUrl = resolveBaseUrlForEnqueueLinksFiltering({
enqueueStrategy: options.strategy,
finalRequestUrl: crawlingContext.request.loadedUrl,
originalRequestUrl: crawlingContext.request.url,
userProvidedBaseUrl: options.baseUrl,
});
const urls = await extractLinks(options);
return addRequests(urls, {View on GitHub (pinned to dbe57fb09c)
Solutions
- Access context.response only in the request handler after navigation has run
- Add a guard: check that response exists before using it
- For about:/null responses, use the page directly instead of the response object
Example fix
// before
async requestHandler(ctx) { ... } // but middleware before navigation does: ctx.response.status
// after
// in post-navigation code only:
if (ctx.response) { const status = ctx.response.status; } Defensive patterns
Strategy: validation
Validate before calling
const status = ctx.response ? ctx.response.status : undefined;
Type guard
function hasResponse<T extends { response?: Response | undefined }>(ctx: T): ctx is T & { response: Response } {
try { void ctx.response; return true; } catch { return false; }
} Try / catch
let response: Response | undefined;
try { response = ctx.response; } catch { /* accessed before navigation or about: URL */ } Prevention
- Access response only inside the request handler after navigation
- Treat about: URLs as having no response
- Keep custom middlewares from reading post-navigation context before navigation runs
When it happens
Trigger: Reading context.response inside a hook/middleware that runs before navigation (e.g. context preparation, pre-navigation hooks), or after navigation to an `about:` URL where response is null.
Common situations: Custom middlewares added before the navigation middleware reading response; request handlers relying on response for about:blank navigation; accessing response in prepareRequest-like callbacks.
Related errors
- The `gotoOptions` property is not available until `prepareNa
- Navigation timed out after ${this.#navigationTimeoutMillis /
- The `request.loadedUrl` property is not available - `skipNav
- The `response` property is not available - `skipNavigation`
- This crawler instance is already running, you can add more r
AI-assisted analysis of apify/crawlee@dbe57fb09c (2026-08-30).
Data as JSON: /api/errors/f0543d0367d0ea79.
Report an issue: GitHub.