{"record":{"id":"5540097d3a8f63d2","repo":"affaan-m/ECC","slug":"launch-and-dry-run-are-mutually-exclusive","errorCode":null,"errorMessage":"--launch and --dry-run are mutually exclusive.","messagePattern":"--launch and --dry-run are mutually exclusive\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"skills/terminal-opener/scripts/open-terminal.js","lineNumber":137,"sourceCode":"    } else if (argument === '--detect') {\n      options.detect = true;\n    } else if (argument === '--launch') {\n      launchRequested = true;\n      options.dryRun = false;\n    } else if (argument === '--dry-run') {\n      dryRunRequested = true;\n      options.dryRun = true;\n    } else if (argument === '--json') {\n      options.json = true;\n    } else if (argument === '--help' || argument === '-h') {\n      options.help = true;\n    } else {\n      throw new Error(`Unknown option \"${argument}\"; put the executable after --.`);\n    }\n  }\n\n  if (launchRequested && dryRunRequested) {\n    throw new Error('--launch and --dry-run are mutually exclusive.');\n  }\n\n  validateTerminalName(options.terminal);\n  validateCwd(options.cwd);\n  if (!options.help && !options.detect && !options.executable) {\n    throw new Error('An executable is required after --.');\n  }\n  if (options.executable) validateExecutable(options.executable);\n  validateArgv(options.argv);\n  return options;\n}\n\nfunction unsupportedPlan(options) {\n  return {\n    ok: false,\n    reason: 'unsupported-terminal',\n    action: `Terminal \"${options.terminal}\" is not supported. Install WezTerm, then rerun with --terminal wezterm.`,\n    terminal: options.terminal,","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/skills/terminal-opener/scripts/open-terminal.js#L119-L155","documentation":"parseArgs rejects command lines that pass both --launch and --dry-run. --launch forces a terminal window to open and run the executable, while --dry-run only prints what would happen without spawning anything; together they are contradictory, so the parser fails fast instead of guessing an intent.","triggerScenarios":"Invoking `node open-terminal.js --launch --dry-run -- <executable>` (in either order) makes both launchRequested and dryRunRequested true, hitting the mutual-exclusion check after option parsing.","commonSituations":"Shell aliases or wrapper scripts that hardcode --launch combined with a user-supplied --dry-run; copy-pasting example commands from docs where one already had --launch and the user appends --dry-run to 'see what it would do'; CI templates merging both flags.","solutions":["Remove either --launch or --dry-run from the command line; keep --dry-run alone to preview the command.","If a wrapper script injects --launch, drop the manual --dry-run flag or make the wrapper conditional.","Use --detect (without --launch) if the goal is inspecting terminal capability without launching."],"exampleFix":"// before\nnode open-terminal.js --launch --dry-run -- vim notes.txt\n// after\nnode open-terminal.js --dry-run -- vim notes.txt","handlingStrategy":"validation","validationCode":"const hasLaunch = argv.includes('--launch');\nconst hasDryRun = argv.includes('--dry-run');\nif (hasLaunch && hasDryRun) throw new Error('Pass either --launch or --dry-run, not both.');","typeGuard":null,"tryCatchPattern":"try {\n  const options = parseArgs(argv);\n} catch (err) {\n  if (err.message.includes('mutually exclusive')) {\n    console.error('Usage: open-terminal [--launch|--dry-run] [--terminal T] [--cwd D] -- <executable>');\n    process.exitCode = 2;\n  } else throw err;\n}","preventionTips":["Use a CLI parser with explicit conflict declarations (e.g. commander .conflicts()) so the constraint is enforced at definition time.","Keep flag sets for 'preview' and 'execute' modes disjoint in wrapper scripts.","Test wrappers with both flags present to catch accidental merge."],"tags":["cli","argument-validation"],"backgroundTag":"mutually-exclusive-flags","analyzedSha":"8321021c54d670126ce3b2969d5deb880b4b0c2a","analyzedAt":"2026-09-16T10:08:13.343Z","contentChangedAt":"2026-09-16T10:08:13.343Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}