{"record":{"id":"f0543d0367d0ea79","repo":"apify/crawlee","slug":"the-response-property-is-not-available-this-mig","errorCode":null,"errorMessage":"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)","messagePattern":"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\\)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/browser-crawler/src/internals/browser-crawler.ts","lineNumber":606,"sourceCode":"            id: crawlingContext.id,\n            session: crawlingContext.session,\n        });\n        tryCancel();\n\n        const addRequests = crawlingContext.addRequests;\n\n        const extractLinks = async (options?: ExtractLinksOptions): Promise<string[]> => {\n            return extractUrlsFromPage(\n                page as any,\n                options?.selector ?? 'a',\n                options?.baseUrl ?? crawlingContext.request.loadedUrl ?? crawlingContext.request.url,\n            );\n        };\n\n        return {\n            page,\n            get response(): Response {\n                throw new Error(\n                    \"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)\",\n                );\n            },\n            get gotoOptions(): Dictionary {\n                throw new Error('The `gotoOptions` property is not available until `prepareNavigation` runs.');\n            },\n            extractLinks,\n            enqueueLinks: async (options: EnqueueLinksOptions = {}) => {\n                const baseUrl = resolveBaseUrlForEnqueueLinksFiltering({\n                    enqueueStrategy: options.strategy,\n                    finalRequestUrl: crawlingContext.request.loadedUrl,\n                    originalRequestUrl: crawlingContext.request.url,\n                    userProvidedBaseUrl: options.baseUrl,\n                });\n\n                const urls = await extractLinks(options);\n\n                return addRequests(urls, {","sourceCodeStart":588,"sourceCodeEnd":624,"githubUrl":"https://github.com/apify/crawlee/blob/dbe57fb09ca607ad59dcf998f3925ef9ac3bb26c/packages/browser-crawler/src/internals/browser-crawler.ts#L588-L624","documentation":"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.","triggerScenarios":"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.","commonSituations":"Custom middlewares added before the navigation middleware reading response; request handlers relying on response for about:blank navigation; accessing response in prepareRequest-like callbacks.","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"],"exampleFix":"// before\nasync requestHandler(ctx) { ... } // but middleware before navigation does: ctx.response.status\n// after\n// in post-navigation code only:\nif (ctx.response) { const status = ctx.response.status; }","handlingStrategy":"validation","validationCode":"const status = ctx.response ? ctx.response.status : undefined;","typeGuard":"function hasResponse<T extends { response?: Response | undefined }>(ctx: T): ctx is T & { response: Response } {\n    try { void ctx.response; return true; } catch { return false; }\n}","tryCatchPattern":"let response: Response | undefined;\ntry { response = ctx.response; } catch { /* accessed before navigation or about: URL */ }","preventionTips":["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"],"tags":["lifecycle","browser","navigation"],"backgroundTag":"property-not-available-yet","analyzedSha":"dbe57fb09ca607ad59dcf998f3925ef9ac3bb26c","analyzedAt":"2026-08-30T22:22:28.328Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}