{"record":{"id":"a5d4463b00e566a4","repo":"apify/crawlee","slug":"request-options-are-not-valid-the-requestsfromur","errorCode":null,"errorMessage":"Request options are not valid, the 'requestsFromUrl' property is not a string. Input: ${inspect(opts)}","messagePattern":"Request options are not valid, the 'requestsFromUrl' property is not a string\\. Input: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/src/storages/request_queue.ts","lineNumber":613,"sourceCode":"                // Validate the input\n                if (typeof opts === 'object' && opts !== null) {\n                    if (opts.url !== undefined && typeof opts.url !== 'string') {\n                        throw new Error(\n                            `Request options are not valid, the 'url' property is not a string. Input: ${inspect(opts)}`,\n                        );\n                    }\n\n                    if (opts.id !== undefined) {\n                        throw new Error(\n                            `Request options are not valid, the 'id' property must not be present. Input: ${inspect(opts)}`,\n                        );\n                    }\n\n                    if (\n                        (opts as any).requestsFromUrl !== undefined &&\n                        typeof (opts as any).requestsFromUrl !== 'string'\n                    ) {\n                        throw new Error(\n                            `Request options are not valid, the 'requestsFromUrl' property is not a string. Input: ${inspect(opts)}`,\n                        );\n                    }\n                }\n\n                if (opts && typeof opts === 'object' && 'requestsFromUrl' in opts) {\n                    // Handle URL lists right away\n                    await addRequest(opts, { forefront });\n                } else {\n                    // Yield valid requests\n                    yield typeof opts === 'string' ? { url: opts } : (opts as RequestOptions);\n                }\n            }\n        }\n\n        return drainRequestBatches<RequestOptions>({\n            items: generateRequests(),\n            batchSize,","sourceCodeStart":595,"sourceCodeEnd":631,"githubUrl":"https://github.com/apify/crawlee/blob/dbe57fb09ca607ad59dcf998f3925ef9ac3bb26c/packages/core/src/storages/request_queue.ts#L595-L631","documentation":"generateRequests() validates that if a request options object declares requestsFromUrl (remote list sourcing), its value must be a string URL. A non-string value (null, number, object) cannot be used to fetch a remote list, so the library throws with an inspect() dump of the offending input.","triggerScenarios":"Calling addRequestsBatched with items like { requestsFromUrl: null } or { requestsFromUrl: someObject }; dynamically building options where the remote URL variable is undefined/null or the wrong type; JSON config where the field is empty.","commonSituations":"Config-driven crawls where the list URL env var is unset and passed straight through; template objects pre-created with requestsFromUrl key but filled later; CSV/API data supplying numeric or nested values for the field.","solutions":["Only include the requestsFromUrl key when it has a valid string URL, or set it to a string","Coerce config values and validate with typeof before enqueuing","Drop items lacking a valid requestsFromUrl (and url) before calling addRequestsBatched","Validate environment/config variables feeding the field are non-empty strings"],"exampleFix":"// before\nawait queue.addRequestsBatched([{ requestsFromUrl: process.env.LIST_URL }]); // may be undefined\n// after\nconst requests = typeof process.env.LIST_URL === 'string' && process.env.LIST_URL\n    ? [{ requestsFromUrl: process.env.LIST_URL }] : [];\nawait queue.addRequestsBatched(requests);","handlingStrategy":"validation","validationCode":"if ('requestsFromUrl' in opts && typeof opts.requestsFromUrl !== 'string') {\n  throw new Error(`requestsFromUrl must be a string, got ${typeof opts.requestsFromUrl}`);\n}","typeGuard":"function hasValidRequestsFromUrl(r) {\n  return !(r && typeof r === 'object' && 'requestsFromUrl' in r && r.requestsFromUrl !== undefined)\n    || typeof r.requestsFromUrl === 'string';\n}","tryCatchPattern":"try {\n  await queue.addRequestsBatched(requests);\n} catch (err) {\n  if (err.message.includes(\"'requestsFromUrl' property is not a string\")) {\n    logger.error(`Bad remote-list option: ${err.message}`);\n  } else throw err;\n}","preventionTips":["Only set requestsFromUrl with a validated non-empty string URL","Validate config/env values feeding this field before enqueuing","Omit the key entirely when there is no remote list"],"tags":["validation","request-queue","type-error"],"backgroundTag":"invalid-input-type","analyzedSha":"dbe57fb09ca607ad59dcf998f3925ef9ac3bb26c","analyzedAt":"2026-08-30T22:22:28.328Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}