mochajs/mocha · error · InvalidArgumentValueError

ERR_MOCHA_INVALID_ARG_VALUE

ERR_MOCHA_INVALID_ARG_VALUE

Error message

run() was unable to deserialize the options

What it means

Error "run() was unable to deserialize the options" thrown in mochajs/mocha.

Source

Thrown at lib/nodejs/worker.cjs:91

      "file",
      "string",
    );
  }

  debug("run(): running test file %s", filepath);

  if (typeof serializedOptions !== "string") {
    throw createInvalidArgumentTypeError(
      "run() expects second parameter to be a string which was serialized by the `serialize-javascript` module",
      "serializedOptions",
      "string",
    );
  }
  let argv;
  try {
    argv = eval("(" + serializedOptions + ")");
  } catch {
    throw createInvalidArgumentValueError(
      "run() was unable to deserialize the options",
      "serializedOptions",
      serializedOptions,
    );
  }

  const opts = Object.assign({ ui: "bdd" }, argv, {
    // if this was true, it would cause infinite recursion.
    parallel: false,
    // this doesn't work in parallel mode
    forbidOnly: true,
    // it's useful for a Mocha instance to know if it's running in a worker process.
    isWorker: true,
  });

  await bootstrap(opts);

  opts.rootHooks = rootHooks;

View on GitHub (pinned to 6bcbee4fd9)

When it happens

Trigger: Thrown at lib/nodejs/worker.cjs:91 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of mochajs/mocha@6bcbee4fd9 (2026-09-01). Data as JSON: /api/errors/37e9cc901b311d84. Report an issue: GitHub.