openai/codex-plugin-cc · error · Error

Unknown option: ${arg}

Error message

Unknown option: ${arg}

What it means

Thrown by parseArgs() in bump-version.mjs for any token starting with '-' that is not one of the recognised flags (--check, --root, --help, -h). It is the catch-all for unrecognized options, enforcing a closed flag set.

Source

Thrown at scripts/bump-version.mjs:110

    version: null
  };

  for (let i = 0; i < argv.length; i += 1) {
    const arg = argv[i];

    if (arg === "--check") {
      options.check = true;
    } else if (arg === "--root") {
      const root = argv[i + 1];
      if (!root) {
        throw new Error("--root requires a directory.");
      }
      options.root = root;
      i += 1;
    } else if (arg === "--help" || arg === "-h") {
      options.help = true;
    } else if (arg.startsWith("-")) {
      throw new Error(`Unknown option: ${arg}`);
    } else if (options.version) {
      throw new Error(`Unexpected extra argument: ${arg}`);
    } else {
      options.version = arg;
    }
  }

  options.root = path.resolve(options.root);
  return options;
}

function validateVersion(version) {
  if (!VERSION_PATTERN.test(version)) {
    throw new Error(`Expected a semver-like version such as 1.0.3, got: ${version}`);
  }
}

function requireObject(value, label) {

View on GitHub (pinned to db52e28f4d)

Solutions

  1. Remove the unknown flag or replace it with a supported one (--check, --root, --help, -h).
  2. Run with --help to see the accepted options.
  3. If passing a value that starts with '-', restructure so it is not the first token or is not dash-prefixed.

Example fix

// before
$ node scripts/bump-version.mjs --dry-run 1.0.0

// after
$ node scripts/bump-version.mjs 1.0.0
Defensive patterns

Strategy: validation

Validate before calling

const SUPPORTED_FLAGS = new Set(["--check", "--root", "--help", "-h"]);

function validateFlags(argv) {
  for (const a of argv) {
    if (a.startsWith("-") && !SUPPORTED_FLAGS.has(a) && !(argv[argv.indexOf(a) - 1] === "--root")) {
      throw new Error(`Unknown option: ${a}. Supported: ${[...SUPPORTED_FLAGS].join(", ")}`);
    }
  }
}

Prevention

When it happens

Trigger: Passing an unsupported flag such as --dry-run, --force, -v, --prerelease, or any mistyped flag (e.g. --checl). Any token matching /^-/ that is not explicitly handled hits this branch.

Common situations: Typo in a flag name; assuming a common flag (like --force or --dry-run) exists when it doesn't; passing a global flag meant for a different tool; negative-number or dash-leading value mistaken for an option.

Related errors


AI-assisted analysis of openai/codex-plugin-cc@db52e28f4d (2026-08-13). Data as JSON: /api/errors/1509141510e59347. Report an issue: GitHub.