affaan-m/ECC · error · Error

Unknown option " "; put the executable after --.

Error message

Unknown option "${argument}"; put the executable after --.

What it means

parseArgs only recognizes a fixed set of flags (--launch, --dry-run, --json, --help/-h, and the value-taking options) and throws this error for any unrecognized token in the option region. The message reminds users that the executable and its arguments belong after a `--` separator, where everything is treated as the launch command instead of being parsed as options.

Solutions

  1. Add the missing `--` before the executable: `node open-terminal.js --terminal wezterm -- mycmd args`.
  2. Fix the flag typo (check `--help` for the supported option list).
  3. Remove unsupported flags; if a flag is genuinely needed, add it to the parseArgs dispatch in open-terminal.js.

Example fix

// before
node open-terminal.js --terminal wezterm wezterm start
// after
node open-terminal.js --terminal wezterm -- wezterm start
Defensive patterns

Strategy: validation

Validate before calling

const KNOWN = new Set(['--terminal','--cwd','--executable','--launch','--dry-run','--json','--help','-h']);
const dd = process.argv.indexOf('--');
const optionRegion = dd === -1 ? process.argv.slice(2) : process.argv.slice(2, dd);
optionRegion.forEach(t => { if (t.startsWith('-') && !KNOWN.has(t)) throw new Error(`unknown option ${t}`); });

Type guard

null

Try / catch

try {
  parseArgs(process.argv);
} catch (e) {
  if (/Unknown option/.test(e.message)) {
    console.error(e.message, '— run with --help to list supported flags');
  } else throw e;
}

Prevention

When it happens

Trigger: Typos like `--lanuch` or `--verbos`; passing the command before `--` (e.g. `open-terminal.js wezterm start`); inventing flags that don't exist in the script.

Common situations: Users copying commands from other tools with different flag sets; forgetting the `--` separator so positional command words are parsed as options; renamed/removed flags from an older script version.

Understand the failure class

Background: "Unknown argument", "Invalid value", and "must be one of": invalid CLI argument errors explained — this error's family across 35 libraries.

Related errors


AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16). Data as JSON: /api/errors/9cf83e096e7bac07. Report an issue: GitHub.

Appendix: source

Thrown at skills/terminal-opener/scripts/open-terminal.js:132

      const value = readValue(argv, index, argument);
      options[argument.slice(2)] = value;
      index += 1;
    } else if (argument === '--recover' || argument === '--standalone') {
      options.mode = 'recover';
    } else if (argument === '--detect') {
      options.detect = true;
    } else if (argument === '--launch') {
      launchRequested = true;
      options.dryRun = false;
    } else if (argument === '--dry-run') {
      dryRunRequested = true;
      options.dryRun = true;
    } else if (argument === '--json') {
      options.json = true;
    } else if (argument === '--help' || argument === '-h') {
      options.help = true;
    } else {
      throw new Error(`Unknown option "${argument}"; put the executable after --.`);
    }
  }

  if (launchRequested && dryRunRequested) {
    throw new Error('--launch and --dry-run are mutually exclusive.');
  }

  validateTerminalName(options.terminal);
  validateCwd(options.cwd);
  if (!options.help && !options.detect && !options.executable) {
    throw new Error('An executable is required after --.');
  }
  if (options.executable) validateExecutable(options.executable);
  validateArgv(options.argv);
  return options;
}

function unsupportedPlan(options) {

View on GitHub (pinned to 8321021c54)