openai/codex-plugin-cc · error · Error

Expected a semver-like version such as 1.0.3, got: ${version

Error message

Expected a semver-like version such as 1.0.3, got: ${version}

What it means

Thrown by validateVersion() when the supplied version string fails the VERSION_PATTERN regex: ^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(optional prerelease)(optional build). It enforces a semver-like shape with no leading zeros in numeric parts. Prerelease/build suffixes are allowed but the numeric core must be clean.

Source

Thrown at scripts/bump-version.mjs:124

      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) {
  if (!value || typeof value !== "object" || Array.isArray(value)) {
    throw new Error(`Expected ${label} to be an object.`);
  }
}

function findMarketplacePlugin(json) {
  const plugin = json.plugins?.find((entry) => entry?.name === "codex");
  requireObject(plugin, ".claude-plugin/marketplace.json plugins[codex]");
  return plugin;
}

function readJson(root, file) {
  const filePath = path.join(root, file);
  return JSON.parse(fs.readFileSync(filePath, "utf8"));

View on GitHub (pinned to db52e28f4d)

Solutions

  1. Pass a full X.Y.Z version: 1.0.3 (optionally with -prerelease or +build suffixes).
  2. Drop any 'v' prefix before the numerics.
  3. Avoid leading zeros in numeric segments (use 1.0.3 not 01.0.3).

Example fix

// before
$ node scripts/bump-version.mjs v1.0.3

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

Strategy: validation

Validate before calling

const SEMVER = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/;

function assertSemver(version) {
  if (!SEMVER.test(version)) {
    throw new Error(`'${version}' is not a semver X.Y.Z string.`);
  }
}

assertSemver(version); // before invoking bump-version

Type guard

function isSemverVersion(value) {
  return typeof value === "string" && /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/.test(value);
}

Prevention

When it happens

Trigger: Passing a version like '1.0', '1.0.0.0', 'v1.0.0', '01.2.3', '1.2', 'latest', or any non-semver string to bump-version.mjs as the positional, or to --check via package.json's version field.

Common situations: Adding a 'v' prefix ('v1.0.0'); truncating to major.minor; leading zeros from a zero-padded build number; using a dist-tag like 'next'; copying a non-semver version from another manifest.

Related errors


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