{"record":{"id":"9d9d809f288a80be","repo":"openai/codex-plugin-cc","slug":"version-metadata-is-out-of-sync-n-mismatches-joi","errorCode":null,"errorMessage":"Version metadata is out of sync:\\n${mismatches.join(\"\\n\")}","messagePattern":"Version metadata is out of sync:\\\\n(.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/bump-version.mjs","lineNumber":211,"sourceCode":"}\n\nfunction main() {\n  const options = parseArgs(process.argv.slice(2));\n  if (options.help) {\n    console.log(usage());\n    return;\n  }\n\n  const version = options.version ?? (options.check ? readPackageVersion(options.root) : null);\n  if (!version) {\n    throw new Error(`Missing version.\\n\\n${usage()}`);\n  }\n  validateVersion(version);\n\n  if (options.check) {\n    const mismatches = checkVersions(options.root, version);\n    if (mismatches.length > 0) {\n      throw new Error(`Version metadata is out of sync:\\n${mismatches.join(\"\\n\")}`);\n    }\n    console.log(`All version metadata matches ${version}.`);\n    return;\n  }\n\n  const changedFiles = bumpVersion(options.root, version);\n  const touched = changedFiles.length > 0 ? changedFiles.join(\", \") : \"no files changed\";\n  console.log(`Set version metadata to ${version}: ${touched}.`);\n}\n\ntry {\n  main();\n} catch (error) {\n  console.error(error instanceof Error ? error.message : String(error));\n  process.exitCode = 1;\n}\n","sourceCodeStart":193,"sourceCodeEnd":228,"githubUrl":"https://github.com/openai/codex-plugin-cc/blob/db52e28f4d9ded852ab3942cea316258ae4ef346/scripts/bump-version.mjs#L193-L228","documentation":"Thrown by main()/checkVersions() during --check when one or more of the four target manifests (package.json, package-lock.json, plugin.json, marketplace.json — each with one or more version fields) hold a version that differs from the expected version. The message lists every mismatch with file, field label, expected vs found value. It enforces that all version metadata across the repo is in sync.","triggerScenarios":"Running `node scripts/bump-version.mjs --check [version]` where any tracked version field disagrees. With an explicit version, that is the expected value; without one, package.json's version is the baseline. A single drifted field (e.g. package-lock.json not updated) triggers it.","commonSituations":"Bumping package.json manually but forgetting package-lock.json or marketplace.json; an npm install rewriting package-lock.json's version; plugin.json version left behind after a release; partial version bump interrupted mid-way.","solutions":["Run `node scripts/bump-version.mjs <target-version>` (without --check) to write the version into all manifests and resync them.","Manually correct the specific drifted file(s) listed in the mismatch output.","Re-run --check to confirm all fields agree."],"exampleFix":"// before\n$ node scripts/bump-version.mjs --check\n# Version metadata is out of sync:\n# package-lock.json version: expected 1.0.3, found 1.0.2\n\n// after\n$ node scripts/bump-version.mjs 1.0.3\n$ node scripts/bump-version.mjs --check\n# All version metadata matches 1.0.3.","handlingStrategy":"validation","validationCode":"// Pre-flight: ensure all tracked fields already equal the target before --check.\nfunction versionsInSync(root, expected) {\n  const mismatches = checkVersions(root, expected);\n  return mismatches.length === 0;\n}\n\nif (!versionsInSync(root, target)) {\n  // run the bump (without --check) to resync, then re-check\n  bumpVersion(root, target);\n}","typeGuard":null,"tryCatchPattern":"try {\n  // run check in CI\n} catch (err) {\n  if (/Version metadata is out of sync/.test(err.message)) {\n    // fail the release gate; require a bump commit\n  } else throw err;\n}","preventionTips":["Always run the bump (not --check) to update every manifest at once; never edit versions piecemeal.","Gate releases on `bump-version.mjs --check` so drift fails fast.","Regenerate package-lock.json after bumping package.json to keep packages[\"\"].version aligned."],"tags":["validation","manifest","bump-version","sync","release"],"backgroundTag":null,"analyzedSha":"db52e28f4d9ded852ab3942cea316258ae4ef346","analyzedAt":"2026-08-13T05:13:20.855Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}