{"record":{"id":"109fc985bdab51ea","repo":"apify/crawlee","slug":"the-contenttype-property-is-not-available-ski","errorCode":null,"errorMessage":"The `contentType` property is not available - `skipNavigation` was used","messagePattern":"The `contentType` property is not available - `skipNavigation` was used","errorType":"exception","errorClass":"NavigationSkippedError","httpStatus":null,"severity":"error","filePath":"packages/http-crawler/src/internals/http-crawler.ts","lineNumber":557,"sourceCode":"            `Navigation timed out after ${this.#navigationTimeoutMillis / 1000} seconds.`,\n        );\n        tryCancel();\n\n        request.loadedUrl = httpResponse?.url;\n        request.state = RequestState.AFTER_NAV;\n\n        return { request: request as LoadedRequest<CrawleeRequest>, response: httpResponse };\n    }\n\n    private async processHttpResponse(\n        crawlingContext: CrawlingContextWithResponse,\n    ): Promise<\n        Omit<InternalHttpCrawlingContext, keyof CrawlingContextWithResponse> & Partial<InternalHttpCrawlingContext>\n    > {\n        if (crawlingContext.request.skipNavigation) {\n            return {\n                get contentType(): InternalHttpCrawlingContext['contentType'] {\n                    throw new NavigationSkippedError(\n                        'The `contentType` property is not available - `skipNavigation` was used',\n                    );\n                },\n                get body(): InternalHttpCrawlingContext['body'] {\n                    throw new NavigationSkippedError(\n                        'The `body` property is not available - `skipNavigation` was used',\n                    );\n                },\n                get json(): InternalHttpCrawlingContext['json'] {\n                    throw new NavigationSkippedError(\n                        'The `json` property is not available - `skipNavigation` was used',\n                    );\n                },\n                get waitForSelector(): InternalHttpCrawlingContext['waitForSelector'] {\n                    throw new NavigationSkippedError(\n                        'The `waitForSelector` method is not available - `skipNavigation` was used',\n                    );\n                },","sourceCodeStart":539,"sourceCodeEnd":575,"githubUrl":"https://github.com/apify/crawlee/blob/dbe57fb09ca607ad59dcf998f3925ef9ac3bb26c/packages/http-crawler/src/internals/http-crawler.ts#L539-L575","documentation":"NavigationSkippedError thrown by the getter for `contentType` on the crawling context. Since `skipNavigation` requests are never fetched, there is no Content-Type to expose; the getter throws to surface misuse immediately.","triggerScenarios":"Reading `context.contentType` in a request handler for a request marked `skipNavigation: true`.","commonSituations":"Handlers that branch on content type (HTML vs JSON parsing) without checking whether navigation happened; shared parse utilities assuming a fetched response.","solutions":["Check `request.skipNavigation` before accessing `contentType`.","Hardcode or infer the type from the URL/request metadata for skipped requests.","Use a separate handler (e.g. via label routing) for skipNavigation requests."],"exampleFix":"// before\nif (context.contentType?.includes('json')) { parseJson(context.body); }\n// after\nif (!context.request.skipNavigation && context.contentType?.includes('json')) { parseJson(context.body); }","handlingStrategy":"type-guard","validationCode":"if (!request.skipNavigation && ctx.contentType) { branchOnType(ctx.contentType); }","typeGuard":"function hasContentType(ctx: CrawlingContext): boolean { return !(ctx.request as any).skipNavigation; }","tryCatchPattern":"try { const ct = ctx.contentType; } catch (err) { if (err instanceof NavigationSkippedError) { /* infer from url or userData */ } else throw err; }","preventionTips":["Check skipNavigation before any content-type branching.","Record expected mime type in request.userData at queue time.","Dedicated handlers for skipNavigation entries.","Code-review handlers for unconditional context property access."],"tags":["skip-navigation","content-type","http-crawler"],"backgroundTag":"navigation-skipped-property-access","analyzedSha":"dbe57fb09ca607ad59dcf998f3925ef9ac3bb26c","analyzedAt":"2026-08-30T22:22:28.328Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}