{"record":{"id":"dfbb3444c17b805c","repo":"Hmbown/CodeWhale","slug":"invalid-checksum-manifest-line-trimmed","errorCode":null,"errorMessage":"Invalid checksum manifest line: ${trimmed}","messagePattern":"Invalid checksum manifest line: (.+?)","errorType":"exception","errorClass":"NonRetryableError","httpStatus":null,"severity":"error","filePath":"npm/codewhale/scripts/install.js","lineNumber":1162,"sourceCode":"async function fileExists(file) {\n  try {\n    const result = await stat(file);\n    return result.isFile();\n  } catch {\n    return false;\n  }\n}\n\nfunction parseChecksumManifest(text) {\n  const checksums = new Map();\n  for (const line of text.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 NonRetryableError(`Invalid checksum manifest line: ${trimmed}`);\n    }\n    checksums.set(match[2], match[1].toLowerCase());\n  }\n  return checksums;\n}\n\nasync function sha256File(filePath) {\n  const content = await readFile(filePath);\n  return crypto.createHash(\"sha256\").update(content).digest(\"hex\");\n}\n\nasync function verifyChecksum(filePath, assetName, checksums, sourceLabel) {\n  const expected = checksums.get(assetName);\n  if (!expected) {\n    const from = sourceLabel ? ` from ${sourceLabel}` : \"\";\n    throw new NonRetryableError(`Checksum manifest is missing ${assetName}${from}`);\n  }\n  const actual = await sha256File(filePath);","sourceCodeStart":1144,"sourceCodeEnd":1180,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/433685b2024e7bc4c99e1e2e326bcad39b4d9d65/npm/codewhale/scripts/install.js#L1144-L1180","documentation":"The installer parses a SHA256SUMS-style manifest, one line per asset, matching `^([a-fA-F0-9]{64})\\s+\\*?(.+)$` (hex digest, whitespace, optional binary marker, filename). Any non-blank line that does not match — a comment, a truncated digest, a different hash algorithm, or a two-column format with extra fields — throws this NonRetryableError.","triggerScenarios":"Downloading a checksum manifest whose body contains lines outside the `<64-hex> <filename>` format: HTML error pages saved as a file, changelog text, md5/sha1 length digests, or extra annotation columns.","commonSituations":"Custom CODEWHALE_RELEASE_BASE_URL mirrors hosting a differently formatted checksums file; a proxy/error page served in place of the manifest; an upstream release that switched manifest formats.","solutions":["Inspect the manifest at the URL (curl it) and confirm it is a standard sha256sum format with 64-hex digests.","Regenerate the manifest on the mirror with `sha256sum -b * > SHA256SUMS`.","Point CODEWHALE_RELEASE_BASE_URL at the official release source, which ships a known-good manifest.","Check you did not hit a proxy/login page — re-fetch and verify content-type."],"exampleFix":"// before (manifest line with sha1)\ncb20ac7e9...40-hex  codewhale-linux-x64\n// after\n<64-char sha256 hex>  codewhale-linux-x64","handlingStrategy":"validation","validationCode":"const res = await fetch(manifestUrl);\nconst text = await res.text();\nconst bad = text.split('\\n').filter(l => l.trim() && !/^[a-fA-F0-9]{64}\\s+\\*?.+$/.test(l.trim()));\nif (bad.length) console.error('Manifest lines not in sha256sum format:', bad);","typeGuard":null,"tryCatchPattern":"try {\n  await install();\n} catch (err) {\n  if (err.message.startsWith('Invalid checksum manifest line:')) {\n    // fetch the manifest, inspect the offending line, fix the mirror or switch sources\n  } else throw err;\n}","preventionTips":["Generate mirror manifests with standard `sha256sum` output.","Serve raw text files — never let a proxy error page masquerade as the manifest.","Sanity-check the manifest with `sha256sum -c` before relying on a custom mirror."],"tags":["npm","installer","checksum","manifest","validation"],"backgroundTag":"invalid-argument-format","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"}