apify/crawlee · error · NavigationSkippedError
The `contentType` property is not available - `skipNavigatio
Error message
The `contentType` property is not available - `skipNavigation` was used
What it means
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.
Source
Thrown at packages/http-crawler/src/internals/http-crawler.ts:557
`Navigation timed out after ${this.#navigationTimeoutMillis / 1000} seconds.`,
);
tryCancel();
request.loadedUrl = httpResponse?.url;
request.state = RequestState.AFTER_NAV;
return { request: request as LoadedRequest<CrawleeRequest>, response: httpResponse };
}
private async processHttpResponse(
crawlingContext: CrawlingContextWithResponse,
): Promise<
Omit<InternalHttpCrawlingContext, keyof CrawlingContextWithResponse> & Partial<InternalHttpCrawlingContext>
> {
if (crawlingContext.request.skipNavigation) {
return {
get contentType(): InternalHttpCrawlingContext['contentType'] {
throw new NavigationSkippedError(
'The `contentType` property is not available - `skipNavigation` was used',
);
},
get body(): InternalHttpCrawlingContext['body'] {
throw new NavigationSkippedError(
'The `body` property is not available - `skipNavigation` was used',
);
},
get json(): InternalHttpCrawlingContext['json'] {
throw new NavigationSkippedError(
'The `json` property is not available - `skipNavigation` was used',
);
},
get waitForSelector(): InternalHttpCrawlingContext['waitForSelector'] {
throw new NavigationSkippedError(
'The `waitForSelector` method is not available - `skipNavigation` was used',
);
},View on GitHub (pinned to dbe57fb09c)
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.
Example fix
// before
if (context.contentType?.includes('json')) { parseJson(context.body); }
// after
if (!context.request.skipNavigation && context.contentType?.includes('json')) { parseJson(context.body); } Defensive patterns
Strategy: type-guard
Validate before calling
if (!request.skipNavigation && ctx.contentType) { branchOnType(ctx.contentType); } Type guard
function hasContentType(ctx: CrawlingContext): boolean { return !(ctx.request as any).skipNavigation; } Try / catch
try { const ct = ctx.contentType; } catch (err) { if (err instanceof NavigationSkippedError) { /* infer from url or userData */ } else throw err; } Prevention
- 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.
When it happens
Trigger: Reading `context.contentType` in a request handler for a request marked `skipNavigation: true`.
Common situations: Handlers that branch on content type (HTML vs JSON parsing) without checking whether navigation happened; shared parse utilities assuming a fetched response.
Related errors
- The `request.loadedUrl` property is not available - `skipNav
- The `response` property is not available - `skipNavigation`
- The `body` property is not available - `skipNavigation` was
- The `json` property is not available - `skipNavigation` was
- The `waitForSelector` method is not available - `skipNavigat
AI-assisted analysis of apify/crawlee@dbe57fb09c (2026-08-30).
Data as JSON: /api/errors/109fc985bdab51ea.
Report an issue: GitHub.