segment-boneyard/nightmare · error · Error

Too few runner arguments: ${JSON.stringify(process.argv)}

Error message

Too few runner arguments: ${JSON.stringify(process.argv)}

What it means

A startup guard in Nightmare's Electron runner process: it checks that process.argv carries at least three entries (node, the runner script, and a JSON configuration blob in argv[2]). The error means the runner was spawned without its required configuration argument, so argv[2] cannot be JSON.parse'd into paths/switches — the faulting input is the missing argv[2] config string, not anything in the host application.

Source

Thrown at lib/runner.js:34

// URL protocols that don't need to be checked for validity
const KNOWN_PROTOCOLS = ['http', 'https', 'file', 'about', 'javascript']
// Property for tracking whether a window is ready for interaction
const IS_READY = Symbol('isReady')

/**
 * Handle uncaught exceptions in the main electron process
 */

process.on('uncaughtException', function(err) {
  parent.emit('uncaughtException', err.stack || err.message || String(err))
})

/**
 * Update the app paths
 */

if (process.argv.length < 3) {
  throw new Error(`Too few runner arguments: ${JSON.stringify(process.argv)}`)
}

var processArgs = JSON.parse(process.argv[2])
var paths = processArgs.paths
if (paths) {
  for (let i in paths) {
    app.setPath(i, paths[i])
  }
}
var switches = processArgs.switches
if (switches) {
  for (let i in switches) {
    app.commandLine.appendSwitch(i, switches[i])
  }
}

/**
 * Hide the dock

View on GitHub (pinned to 0f47de8499)

Solutions

  1. Ensure Nightmare is instantiated correctly (new Nightmare()) and that its internal runner spawn passes the JSON config as the third argv entry
  2. Upgrade nightmare/electron to matching versions; a mismatched or corrupted install can drop the config argument
  3. Reinstall node_modules to rule out a truncated or partially installed electron bundle
  4. Check that nothing in the environment (wrapper scripts, custom spawn options) strips arguments from the electron process
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at lib/runner.js:34 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of segment-boneyard/nightmare@0f47de8499 (2026-09-02). Data as JSON: /api/errors/7df32fc281dab1e7. Report an issue: GitHub.