{"record":{"id":"70a0a96373cf7232","repo":"denoland/deno","slug":"warning-arrayprototypejoin-unsupported","errorCode":null,"errorMessage":"Warning: ${ArrayPrototypeJoin(unsupported, \", \")} option(s) are not supported for web Workers and will be ignored. Use the node:worker_threads module instead.","messagePattern":"Warning: (.+?) option\\(s\\) are not supported for web Workers and will be ignored\\. Use the node:worker_threads module instead\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"runtime/js/11_workers.js","lineNumber":124,"sourceCode":"  // still be messages left to receive.\n  #status = \"RUNNING\";\n\n  constructor(specifier, options = { __proto__: null }) {\n    super();\n    specifier = String(specifier);\n    const {\n      deno,\n      name,\n      type = \"classic\",\n    } = options;\n\n    if (options.env !== undefined || options.workerData !== undefined) {\n      const unsupported = [];\n      if (options.env !== undefined) unsupported[unsupported.length] = \"env\";\n      if (options.workerData !== undefined) {\n        unsupported[unsupported.length] = \"workerData\";\n      }\n      globalThis.console.warn(\n        `Warning: ${\n          ArrayPrototypeJoin(unsupported, \", \")\n        } option(s) are not supported ` +\n          \"for web Workers and will be ignored. Use the \" +\n          \"node:worker_threads module instead.\",\n      );\n    }\n\n    const workerType = webidl.converters[\"WorkerType\"](type);\n\n    if (\n      StringPrototypeStartsWith(specifier, \"./\") ||\n      StringPrototypeStartsWith(specifier, \"../\") ||\n      StringPrototypeStartsWith(specifier, \"/\") || workerType === \"classic\"\n    ) {\n      const baseUrl = getLocationHref();\n      if (baseUrl != null) {\n        specifier = new URL(specifier, baseUrl).href;","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/denoland/deno/blob/9ad36f7a2cce60488e6ec52283efb32efddaf93a/runtime/js/11_workers.js#L106-L142","documentation":"Deno's web Worker constructor (runtime/js/11_workers.js:117-131) warns when it sees env or workerData in the options object: those are node:worker_threads concepts that web Workers ignore. The worker still starts, but the options are dropped, so code relying on them reads undefined env/workerData inside the worker. The warning fires only when either option is present, even if the value is undefined-valued explicitly (options.env !== undefined).","triggerScenarios":"new Worker(specifier, { env: {...} }), new Worker(specifier, { workerData: {...} }), or both — any construction of the global web Worker with node:worker_threads-only options. Passing both produces a combined 'env, workerData' list; passing them to the node:worker_threads Worker instead works and never warns.","commonSituations":"Copy-pasting Node docs/examples that use worker_threads options while using the global Worker; cross-runtime libraries sharing worker code between Node and Deno; migrating Node scripts and expecting per-worker env overrides to apply.","solutions":["Switch to node:worker_threads when you need env or workerData semantics: its Worker accepts these options natively in Deno","Or keep the web Worker and pass per-worker data via postMessage; environment variables are inherited from the parent process automatically","In cross-runtime code, detect the runtime (process.versions?.node vs Deno.version) and choose the right Worker/options pair","If the options were accidental leftovers, delete them to silence the warning"],"exampleFix":"// before\nconst w = new Worker(new URL(\"./w.js\", import.meta.url).href, {\n  type: \"module\",\n  workerData: { jobId: 42 }, // warned and ignored\n});\n\n// after\nimport { Worker } from \"node:worker_threads\";\nconst w = new Worker(new URL(\"./w.js\", import.meta.url), {\n  workerData: { jobId: 42 },\n});","handlingStrategy":"validation","validationCode":"// route node-style options to the implementation that supports them\nconst needsNode = opts.env !== undefined || opts.workerData !== undefined;\nconst { Worker } = needsNode\n  ? await import(\"node:worker_threads\")\n  : { Worker: globalThis.Worker };\nconst w = new Worker(specifier, opts); // web options ignored safely only when absent","typeGuard":"function isWebWorkerSafe(o: Record<string, unknown>): boolean {\n  return o.env === undefined && o.workerData === undefined;\n}","tryCatchPattern":null,"preventionTips":["Use node:worker_threads whenever env or workerData semantics are required","Pass per-worker data with postMessage in web Workers; env vars are inherited from the parent","In cross-runtime code, branch on process.versions?.node / Deno.version before picking a Worker API","Delete stray worker_threads options instead of relying on them being ignored"],"tags":["workers","node-compat","api-mismatch","worker-threads"],"backgroundTag":"unsupported-constructor-option","analyzedSha":"9ad36f7a2cce60488e6ec52283efb32efddaf93a","analyzedAt":"2026-08-20T13:07:44.778Z","contentChangedAt":"2026-08-20T13:07:44.778Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}