affaan-m/ECC · error · Error

An executable is required after --.

Error message

An executable is required after --.

What it means

parseArgs requires an executable to run after the `--` separator. Unless the call is a pure informational mode (--help, --detect, or --executable listing), there is nothing to launch without a trailing executable, so the parser throws instead of building a useless plan.

Solutions

  1. Append ` -- <executable>` (plus any args) to the command line, e.g. `--launch -- vim`.
  2. If you only wanted terminal detection, add --detect instead of an executable.
  3. If you wanted the list of supported terminals, pass --executable (the listing mode) rather than an empty launch.
  4. Check that the variable holding the command in your script is non-empty before invoking.

Example fix

// before
node open-terminal.js --launch
// after
node open-terminal.js --launch -- htop
Defensive patterns

Strategy: validation

Validate before calling

const sep = argv.indexOf('--');
const executable = sep >= 0 ? argv.slice(sep + 1) : [];
if (executable.length === 0 && !argv.includes('--help') && !argv.includes('--detect') && !argv.includes('--executable')) {
  throw new Error('Provide an executable after --, e.g. open-terminal --launch -- vim');
}

Type guard

function hasExecutableAfterSeparator(argv) {
  const sep = argv.indexOf('--');
  return sep !== -1 && argv.length > sep + 1;
}

Try / catch

try {
  const options = parseArgs(argv);
} catch (err) {
  if (err.message.includes('executable is required')) {
    console.error('Missing command: add ` -- <executable>` after your flags.');
    process.exitCode = 2;
  } else throw err;
}

Prevention

When it happens

Trigger: Running `node open-terminal.js --launch` or `node open-terminal.js` with no `-- <command>` suffix, and none of --help/--detect/--executable is present, so options.executable stays undefined.

Common situations: Forgetting the double-dash separator and putting the command as a bare argument before it; passing only flags copied from a help example; shell quoting swallowing the executable argument; scripting where the command variable is empty.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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

Appendix: source

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

      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) {
  return {
    ok: false,
    reason: 'unsupported-terminal',
    action: `Terminal "${options.terminal}" is not supported. Install WezTerm, then rerun with --terminal wezterm.`,
    terminal: options.terminal,
    executable: options.executable,
    argv: [...options.argv],
    cwd: options.cwd,
    dryRun: options.dryRun,
    launchMode: options.mode === 'recover' ? 'recover' : 'mux',
    command: null,

View on GitHub (pinned to 8321021c54)