Hmbown/CodeWhale · error · NonRetryableError

Invalid checksum manifest line

Error message

Invalid checksum manifest line: ${trimmed}

What it means

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.

Solutions

  1. Inspect the manifest at the URL (curl it) and confirm it is a standard sha256sum format with 64-hex digests.
  2. Regenerate the manifest on the mirror with `sha256sum -b * > SHA256SUMS`.
  3. Point CODEWHALE_RELEASE_BASE_URL at the official release source, which ships a known-good manifest.
  4. Check you did not hit a proxy/login page — re-fetch and verify content-type.

Example fix

// before (manifest line with sha1)
cb20ac7e9...40-hex  codewhale-linux-x64
// after
<64-char sha256 hex>  codewhale-linux-x64
Defensive patterns

Strategy: validation

Validate before calling

const res = await fetch(manifestUrl);
const text = await res.text();
const bad = text.split('\n').filter(l => l.trim() && !/^[a-fA-F0-9]{64}\s+\*?.+$/.test(l.trim()));
if (bad.length) console.error('Manifest lines not in sha256sum format:', bad);

Try / catch

try {
  await install();
} catch (err) {
  if (err.message.startsWith('Invalid checksum manifest line:')) {
    // fetch the manifest, inspect the offending line, fix the mirror or switch sources
  } else throw err;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@433685b202 (2026-09-15). Data as JSON: /api/errors/dfbb3444c17b805c. Report an issue: GitHub.

Appendix: source

Thrown at npm/codewhale/scripts/install.js:1162

async function fileExists(file) {
  try {
    const result = await stat(file);
    return result.isFile();
  } catch {
    return false;
  }
}

function parseChecksumManifest(text) {
  const checksums = new Map();
  for (const line of text.split(/\r?\n/)) {
    const trimmed = line.trim();
    if (!trimmed) {
      continue;
    }
    const match = trimmed.match(/^([a-fA-F0-9]{64})\s+\*?(.+)$/);
    if (!match) {
      throw new NonRetryableError(`Invalid checksum manifest line: ${trimmed}`);
    }
    checksums.set(match[2], match[1].toLowerCase());
  }
  return checksums;
}

async function sha256File(filePath) {
  const content = await readFile(filePath);
  return crypto.createHash("sha256").update(content).digest("hex");
}

async function verifyChecksum(filePath, assetName, checksums, sourceLabel) {
  const expected = checksums.get(assetName);
  if (!expected) {
    const from = sourceLabel ? ` from ${sourceLabel}` : "";
    throw new NonRetryableError(`Checksum manifest is missing ${assetName}${from}`);
  }
  const actual = await sha256File(filePath);

View on GitHub (pinned to 433685b202)