{"record":{"id":"6f44c7d1a57b91c5","repo":"Hmbown/CodeWhale","slug":"label-does-not-match-the-authoritative-inventor","errorCode":null,"errorMessage":"${label} does not match the authoritative inventory; missing: ${missing.join(\", \")}; unexpected: ${unexpected.join(\", \")}; duplicate basenames are present","messagePattern":"(.+?) does not match the authoritative inventory; missing: (.+?); unexpected: (.+?); duplicate basenames are present","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/release/assemble-release-assets.js","lineNumber":57,"sourceCode":"    if (!match) {\n      throw new Error(`${label} contains an invalid checksum row: ${trimmed}`);\n    }\n    const name = match[2];\n    if (checksums.has(name)) {\n      throw new Error(`${label} contains duplicate checksum rows for ${name}`);\n    }\n    checksums.set(name, match[1].toLowerCase());\n  }\n  return checksums;\n}\n\nfunction assertExactNames(actualNames, expectedNames, label) {\n  const actual = new Set(actualNames);\n  const expected = new Set(expectedNames);\n  const missing = expectedNames.filter((name) => !actual.has(name));\n  const unexpected = actualNames.filter((name) => !expected.has(name));\n  if (missing.length > 0 || unexpected.length > 0 || actual.size !== actualNames.length) {\n    throw new Error(\n      `${label} does not match the authoritative inventory` +\n        `${missing.length > 0 ? `; missing: ${missing.join(\", \")}` : \"\"}` +\n        `${unexpected.length > 0 ? `; unexpected: ${unexpected.join(\", \")}` : \"\"}` +\n        `${actual.size !== actualNames.length ? \"; duplicate basenames are present\" : \"\"}`,\n    );\n  }\n}\n\nasync function assertManifest(directory, manifestName, expectedNames) {\n  const manifestPath = path.join(directory, manifestName);\n  const checksums = parseChecksumManifest(\n    await fs.readFile(manifestPath, \"utf8\"),\n    manifestName,\n  );\n  assertExactNames([...checksums.keys()], expectedNames, manifestName);\n  for (const name of expectedNames) {\n    const actual = await sha256(path.join(directory, name));\n    if (checksums.get(name) !== actual) {","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/8880682c63083a91624de936797efa3ce9e498fd/scripts/release/assemble-release-assets.js#L39-L75","documentation":"assertExactNames() found that the set of names presented (directory entries or manifest rows) does not equal the authoritative inventory exported by npm/codewhale/scripts/artifacts (allReleaseAssetNames, checksummedReleaseAssetNames, BUNDLE_ASSET_NAMES). The message enumerates missing names, unexpected names, and whether duplicates were present. Both verifyAssetDirectory and assertManifest route through this check.","triggerScenarios":"Running --verify on a directory containing a stray file (.DS_Store, a leftover tarball, an editor temp file); a manifest missing one of the checksummed or bundle asset rows; an extra row for a retired asset; duplicate basenames among entries.","commonSituations":"A new platform asset added to artifacts.js but the build job for it was skipped or failed; CI downloading only a subset of workflow artifacts; local inspection leaving files behind; the inventory edited between build and assemble so expected and produced sets diverge.","solutions":["Reconcile against the message: add the files listed under 'missing' and delete those under 'unexpected' so the set matches the authoritative inventory exactly","Re-run the complete build workflow so every artifact named by allReleaseAssetNames() is produced and downloaded before assemble","Remove stray files from the asset/output directory before verify","If the inventory intentionally changed, update npm/codewhale/scripts/artifacts.js so expected and produced sets agree, then rebuild"],"exampleFix":"# before: verify fails -- unexpected: .DS_Store, old-asset.tar.gz; missing: codewhale-aarch64-linux.tar.gz\n\n# after\ncd assets && rm -f .DS_Store old-asset.tar.gz\ncp /path/to/build/codewhale-aarch64-linux.tar.gz .\nnode scripts/release/assemble-release-assets.js --verify assets","handlingStrategy":"validation","validationCode":"const { allReleaseAssetNames } = require(\"./npm/codewhale/scripts/artifacts\");\nconst fs = require(\"node:fs/promises\");\nasync function directoryMatchesInventory(dir) {\n  const actual = await fs.readdir(dir);\n  const expected = allReleaseAssetNames();\n  const missing = expected.filter((name) => !actual.includes(name));\n  const unexpected = actual.filter((name) => !expected.includes(name));\n  const hasDuplicates = new Set(actual).size !== actual.length;\n  return { ok: missing.length === 0 && unexpected.length === 0 && !hasDuplicates, missing, unexpected, hasDuplicates };\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run the inventory diff (directory listing vs artifacts.js) as a fast pre-check in CI before the full verify","Keep build jobs and the artifacts inventory in the same commit so expected and produced sets cannot drift","Make artifact uploads 'always()' guarded but fail the workflow when any upload step is skipped","Clean local inspection copies of the asset dir before verifying"],"tags":["release","inventory","validation","ci","artifacts"],"backgroundTag":null,"analyzedSha":"8880682c63083a91624de936797efa3ce9e498fd","analyzedAt":"2026-08-16T11:31:27.956Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}