{"record":{"id":"bda040e3ce3914d8","repo":"Hmbown/CodeWhale","slug":"label-contains-duplicate-checksum-rows-for-name","errorCode":null,"errorMessage":"${label} contains duplicate checksum rows for ${name}","messagePattern":"(.+?) contains duplicate checksum rows for (.+?)","errorType":"console","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/release/assemble-release-assets.js","lineNumber":44,"sourceCode":"  const hash = crypto.createHash(\"sha256\");\n  hash.update(await fs.readFile(filePath));\n  return hash.digest(\"hex\");\n}\n\nfunction parseChecksumManifest(content, label) {\n  const checksums = new Map();\n  for (const line of content.split(/\\r?\\n/)) {\n    const trimmed = line.trim();\n    if (!trimmed) {\n      continue;\n    }\n    const match = trimmed.match(/^([a-fA-F0-9]{64})\\s+\\*?(.+)$/);\n    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    );","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/433685b2024e7bc4c99e1e2e326bcad39b4d9d65/scripts/release/assemble-release-assets.js#L26-L62","documentation":"parseChecksumManifest rejects duplicate entries: if the same asset name appears twice in the manifest, the second occurrence throws this Error. Duplicate rows make the authoritative inventory ambiguous, so the parser refuses to guess which digest is correct.","triggerScenarios":"Concatenating two SHA256SUMS files that both list the same asset, or running a generator twice in append mode so a filename appears on two lines.","commonSituations":"CI jobs that accumulate checksum lines across runs, or manually merging checksum output from multiple build directories.","solutions":["Regenerate the manifest from scratch in one pass: `sha256sum * > SHA256SUMS` (overwrite, do not append).","Deduplicate by filename keeping exactly one digest row per name.","Fix the generator script to write with `>` instead of `>>` or to clear prior content."],"exampleFix":"// before\ncat part1.sum part1.sum > SHA256SUMS\n// after\nsha256sum assets/* > SHA256SUMS","handlingStrategy":"validation","validationCode":"const names = text.split('\\n').filter(Boolean).map(l => l.trim().split(/\\s+/).slice(1).join(' '));\nif (new Set(names).size !== names.length) throw new Error('SHA256SUMS has duplicate entries');","typeGuard":null,"tryCatchPattern":"try { await checksums(manifestPath); } catch (e) { if (String(e.message).includes('duplicate checksum rows')) { console.error('Deduplicate SHA256SUMS:', e.message); process.exitCode = 1; } else throw e; }","preventionTips":["Overwrite (>) manifests instead of appending (>>).","Generate the manifest in a single pass from one directory.","Deduplicate by filename when merging checksum outputs."],"tags":["checksums","release","duplicate-entries"],"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"}