{"record":{"id":"53bb275d76750f62","repo":"apify/crawlee","slug":"unknown-enqueue-strategy-strategy-satisfies-nev","errorCode":null,"errorMessage":"Unknown enqueue strategy '${strategy satisfies never}'.","messagePattern":"Unknown enqueue strategy '(.+?)'\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/utils/src/internals/url.ts","lineNumber":116,"sourceCode":"        case 'same-domain': {\n            const originDomain = getDomain(origin.hostname, { mixedInputs: false });\n\n            if (originDomain) {\n                return originDomain === getDomain(target.hostname, { mixedInputs: false });\n            }\n\n            // No registrable domain (e.g. an IP address), fall back to comparing origins.\n            return target.origin === origin.origin;\n        }\n        case 'same-origin':\n            // Compare scheme/host/port directly so a trailing-dot host is normalized.\n            return (\n                target.protocol === origin.protocol &&\n                normalizeHostname(target.hostname) === normalizeHostname(origin.hostname) &&\n                target.port === origin.port\n            );\n        default:\n            throw new Error(`Unknown enqueue strategy '${strategy satisfies never}'.`);\n    }\n}\n\n/**\n * Check whether `target` may be enqueued under `strategy` relative to `origin`: it must use an `http(s)`\n * scheme and match the strategy. On rejection, `reason` is a human-readable message for log output.\n */\nexport function filterUrl(\n    target: string | URL,\n    origin: string | URL,\n    strategy: EnqueueStrategy | `${EnqueueStrategy}`,\n): { allowed: boolean; reason?: string } {\n    const targetUrl = toUrl(target);\n\n    if (targetUrl === null || !ALLOWED_SCHEMES.has(targetUrl.protocol)) {\n        return { allowed: false, reason: UNSUPPORTED_SCHEME_MESSAGE };\n    }\n","sourceCodeStart":98,"sourceCodeEnd":134,"githubUrl":"https://github.com/apify/crawlee/blob/dbe57fb09ca607ad59dcf998f3925ef9ac3bb26c/packages/utils/src/internals/url.ts#L98-L134","documentation":"matchesEnqueueStrategy switches over known EnqueueStrategy values (same-origin, same-hostname, same-domain, regex, etc.). The default branch uses `strategy satisfies never`, so if an unknown strategy value reaches the switch at runtime (TypeScript's exhaustiveness hole — e.g. from untyped JS or an invalid string cast), it throws this error. It signals an invalid EnqueueStrategy value not covered by the library.","triggerScenarios":"Passing an EnqueueStrategy string not in the union (typo like 'sameHost' vs 'same-hostname'), constructing the strategy dynamically from config/env, or calling from plain JavaScript where types are not enforced.","commonSituations":"Config file or CLI flag supplying a strategy string that bypasses TypeScript checks; version change renaming strategy values; user code casting `as EnqueueStrategy` to silence the compiler with an invalid value.","solutions":["Use one of the documented strategy values (same-origin, same-hostname, same-domain, regex...)","Check for typos in your strategy config (case-sensitive exact match)","Avoid `as EnqueueStrategy` casts on raw strings; validate via the union type first","If strategy comes from external config, map/normalize it to the union before enqueueing","Check library changelog if a strategy value was renamed between versions"],"exampleFix":"// before\nawait crawler.addRequests(requests, { strategy: 'sameHost' as EnqueueStrategy });\n\n// after\nawait crawler.addRequests(requests, { strategy: 'same-hostname' });","handlingStrategy":"validation","validationCode":"const STRATEGIES = ['same-origin', 'same-hostname', 'same-domain', 'regex'] as const;\ntype Strategy = typeof STRATEGIES[number];\nfunction toStrategy(v: string): Strategy {\n  if (!STRATEGIES.includes(v as Strategy)) throw new TypeError(`Unknown enqueue strategy '${v}'`);\n  return v as Strategy;\n}","typeGuard":"function isEnqueueStrategy(v: unknown): v is EnqueueStrategy {\n  return typeof v === 'string' && ['same-origin', 'same-hostname', 'same-domain', 'regex'].includes(v);\n}","tryCatchPattern":"try {\n  await crawler.addRequests(reqs, { strategy });\n} catch (err) {\n  if (String(err).startsWith('Unknown enqueue strategy')) {\n    log.warning(`${strategy} invalid; falling back to same-hostname`);\n    await crawler.addRequests(reqs, { strategy: 'same-hostname' });\n  } else throw err;\n}","preventionTips":["Never `as EnqueueStrategy` cast raw strings; validate against the union","Centralize strategy values as constants imported from the library types","Normalize external config strings (case, kebab vs camel) before use","Check the changelog when upgrading Crawlee for strategy renames"],"tags":["typescript","exhaustiveness","enqueue-strategy"],"backgroundTag":"invalid-enum-value","analyzedSha":"dbe57fb09ca607ad59dcf998f3925ef9ac3bb26c","analyzedAt":"2026-08-30T22:22:28.328Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}