{"record":{"id":"59ac30bcadb4d964","repo":"Hmbown/CodeWhale","slug":"npm-package-version-pkg-version-does-not-match","errorCode":null,"errorMessage":"npm package version ${pkg.version} does not match codewhaleBinaryVersion ${version}. Set CODEWHALE_ALLOW_NPM_BINARY_MISMATCH=1 only for an intentional packaging-only npm release.","messagePattern":"npm package version (.+?) does not match codewhaleBinaryVersion (.+?)\\. Set CODEWHALE_ALLOW_NPM_BINARY_MISMATCH=1 only for an intentional packaging-only npm release\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"npm/codewhale/scripts/verify-release-assets.js","lineNumber":59,"sourceCode":"      process.env.CODEWHALE_USE_CNB_MIRROR,\n  );\n}\n\nfunction packageVersionMatchesBinaryVersion(version) {\n  return String(pkg.version).trim() === version;\n}\n\nfunction assertPackageVersionMatchesBinaryVersion(version) {\n  if (packageVersionMatchesBinaryVersion(version)) {\n    return;\n  }\n  if (process.env.CODEWHALE_ALLOW_NPM_BINARY_MISMATCH === \"1\") {\n    console.log(\n      `npm package version ${pkg.version} points at binary release ${version} (allowed packaging-only mismatch).`,\n    );\n    return;\n  }\n  throw new Error(\n    `npm package version ${pkg.version} does not match codewhaleBinaryVersion ${version}. ` +\n      \"Set CODEWHALE_ALLOW_NPM_BINARY_MISMATCH=1 only for an intentional packaging-only npm release.\",\n  );\n}\n\nfunction requestStatus(url, method = \"HEAD\", redirects = 0) {\n  if (redirects > 10) {\n    throw new Error(`Too many redirects while checking ${url}`);\n  }\n  const client = url.startsWith(\"https:\") ? https : http;\n  return new Promise((resolve, reject) => {\n    const req = client.request(\n      url,\n      {\n        method,\n        headers: {\n          \"User-Agent\": \"codewhale-npm-release-check\",\n        },","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/433685b2024e7bc4c99e1e2e326bcad39b4d9d65/npm/codewhale/scripts/verify-release-assets.js#L41-L77","documentation":"verify-release-assets asserts that the npm package.json version equals the codewhaleBinaryVersion the package points at. A mismatch means the npm release does not correspond to the binary release it references, which is only legitimate for deliberate packaging-only releases.","triggerScenarios":"Running the release-asset verification script (run()) when pkg.version !== version and CODEWHALE_ALLOW_NPM_BINARY_MISMATCH is not set to 1.","commonSituations":"Cutting an npm-only patch (e.g. fixing packaging scripts) without bumping codewhaleBinaryVersion; rebasing release branches so versions drift; forgetting to bump package.json after a binary release.","solutions":["Align package.json version with codewhaleBinaryVersion (usually bump package.json to match the binary release)","If this is intentionally packaging-only, set CODEWHALE_ALLOW_NPM_BINARY_MISMATCH=1 for this run","Re-cut the release so both versions match"],"exampleFix":"// package.json\n// before\n\"version\": \"0.9.6\"\n// after\n\"version\": \"0.9.7\" // matches codewhaleBinaryVersion","handlingStrategy":"validation","validationCode":"const pkg = require(\"./package.json\");\nif (pkg.version !== pkg.codewhaleBinaryVersion && process.env.CODEWHALE_ALLOW_NPM_BINARY_MISMATCH !== \"1\") {\n  throw new Error(`version ${pkg.version} != codewhaleBinaryVersion ${pkg.codewhaleBinaryVersion}`);\n}","typeGuard":null,"tryCatchPattern":"try { await run(); } catch (e) { if (/does not match codewhaleBinaryVersion/.test(e.message)) { console.error(\"Bump package.json or set CODEWHALE_ALLOW_NPM_BINARY_MISMATCH=1 for packaging-only releases\"); process.exitCode = 1; } else throw e; }","preventionTips":["Bump package.json and codewhaleBinaryVersion together in release tooling","Add a pre-release CI step running this verification","Set CODEWHALE_ALLOW_NPM_BINARY_MISMATCH only in deliberate packaging-only release jobs"],"tags":["release","npm","versioning","ci"],"backgroundTag":"schema-validation-failed","analyzedSha":"433685b2024e7bc4c99e1e2e326bcad39b4d9d65","analyzedAt":"2026-09-15T12:24:24.634Z","contentChangedAt":"2026-09-15T12:24:24.634Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}