{"record":{"id":"7df32fc281dab1e7","repo":"segment-boneyard/nightmare","slug":"too-few-runner-arguments-json-stringify-process","errorCode":null,"errorMessage":"Too few runner arguments: ${JSON.stringify(process.argv)}","messagePattern":"Too few runner arguments: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"lib/runner.js","lineNumber":34,"sourceCode":"// URL protocols that don't need to be checked for validity\nconst KNOWN_PROTOCOLS = ['http', 'https', 'file', 'about', 'javascript']\n// Property for tracking whether a window is ready for interaction\nconst IS_READY = Symbol('isReady')\n\n/**\n * Handle uncaught exceptions in the main electron process\n */\n\nprocess.on('uncaughtException', function(err) {\n  parent.emit('uncaughtException', err.stack || err.message || String(err))\n})\n\n/**\n * Update the app paths\n */\n\nif (process.argv.length < 3) {\n  throw new Error(`Too few runner arguments: ${JSON.stringify(process.argv)}`)\n}\n\nvar processArgs = JSON.parse(process.argv[2])\nvar paths = processArgs.paths\nif (paths) {\n  for (let i in paths) {\n    app.setPath(i, paths[i])\n  }\n}\nvar switches = processArgs.switches\nif (switches) {\n  for (let i in switches) {\n    app.commandLine.appendSwitch(i, switches[i])\n  }\n}\n\n/**\n * Hide the dock","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/segment-boneyard/nightmare/blob/0f47de84991243cc040e8e020f7aee847c7c4a0e/lib/runner.js#L16-L52","documentation":"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.","triggerScenarios":"Thrown at lib/runner.js:34 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure Nightmare is instantiated correctly (new Nightmare()) and that its internal runner spawn passes the JSON config as the third argv entry","Upgrade nightmare/electron to matching versions; a mismatched or corrupted install can drop the config argument","Reinstall node_modules to rule out a truncated or partially installed electron bundle","Check that nothing in the environment (wrapper scripts, custom spawn options) strips arguments from the electron process"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0f47de84991243cc040e8e020f7aee847c7c4a0e","analyzedAt":"2026-09-02T12:06:19.701Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T16:17:10.729Z"}