ERR_MISSING_PLATFORM_FOR_WORKER
Node.jsERRORNotableChild ProcessHIGH confidence

Worker threads not available — platform not supported

Production Risk

Low in standard environments; critical in embedded Node.js deployments.

What this means

Thrown when the Worker Threads API is used but the underlying V8 platform does not support workers. This can happen in embedded Node.js environments or builds where multi-threading was disabled at compile time.

Why it happens
  1. 1Using worker_threads in a custom Node.js build compiled without worker support
  2. 2Running Node.js in an embedded environment that does not initialise the V8 platform with worker support
How to reproduce

Triggered when new Worker() is called but the V8 platform lacks the necessary scheduler for workers.

trigger — this will error
trigger — this will error
const { Worker } = require('worker_threads');
// On platforms built without worker support:
new Worker('./worker.js'); // throws ERR_MISSING_PLATFORM_FOR_WORKER

expected output

Error [ERR_MISSING_PLATFORM_FOR_WORKER]: The multi-threaded feature is not supported

Fix

Use a standard Node.js build with worker support

WHEN When workers are required

Use a standard Node.js build with worker support
// Verify worker support at startup
const { isMainThread } = require('worker_threads');
if (typeof isMainThread === 'undefined') {
  console.error('Worker threads not supported on this build');
  process.exit(1);
}

Why this works

Standard Node.js builds from nodejs.org include worker support; custom/embedded builds may not.

Code examples
Triggerjs
const { Worker } = require('worker_threads');
// On platforms built without worker support:
new Worker('./worker.js'); // throws ERR_MISSING_PLATFORM_FOR_WORKER  // this triggers ERR_MISSING_PLATFORM_FOR_WORKER
Handle in try/catchjs
try {
  // operation that may throw ERR_MISSING_PLATFORM_FOR_WORKER
  riskyOperation()
} catch (err) {
  if (err.code === 'ERR_MISSING_PLATFORM_FOR_WORKER') {
    console.error('ERR_MISSING_PLATFORM_FOR_WORKER:', err.message)
  } else {
    throw err
  }
}
Defensive pattern to avoid itjs
// Validate inputs before calling the operation
function safe_err_missing_platform_for_worker(...args) {
  // validate args here
  return performOperation(...args)
}
What not to do

Assume worker_threads is available in all environments

Embedded or custom builds may omit worker support; detect and handle gracefully.

Same error in other languages
Sources
Official documentation ↗

Node.js Error Codes Documentation

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All Node.js errors