Hmbown/CodeWhale · error · Error

checksum mismatch for

Error message

${manifestName} checksum mismatch for ${name}

What it means

assertManifest first checks the manifest's name set against the expected inventory (via assertExactNames), then recomputes the sha256 of every expected asset and compares it to the digest recorded in the manifest. Any digest that does not match the actual file bytes throws this Error naming the manifest and the file.

Solutions

  1. Regenerate the checksum manifest from the current files: `sha256sum * > SHA256SUMS`.
  2. Re-download or rebuild the named asset so its bytes match the recorded digest.
  3. Verify you are comparing against the manifest from the same release build, not a previous one.

Example fix

// before
# app.zip rebuilt after SHA256SUMS was written
// after
sha256sum assets/* > SHA256SUMS  # regenerate after every asset change
Defensive patterns

Strategy: validation

Validate before calling

import { createHash } from 'node:crypto';
const digest = createHash('sha256').update(await fs.readFile(asset)).digest('hex');
const recorded = manifestRows.get(basename(asset));
if (recorded && recorded.toLowerCase() !== digest) throw new Error(`stale manifest for ${asset}`);

Try / catch

try { await assertManifest(dir, names, manifestName); } catch (e) { if (String(e.message).includes('checksum mismatch')) { console.error('Regenerate SHA256SUMS or rebuild the asset:', e.message); process.exitCode = 1; } else throw e; }

Prevention

When it happens

Trigger: An asset file was modified (rebuilt with different content, re-zipped, re-timestamped) after the manifest was generated, or the manifest contains a digest from a different build.

Common situations: Editing an asset (e.g. adding a file to a zip) after generating SHA256SUMS, downloading a partially-updated artifact set, or copying an old manifest over new artifacts.

Understand the failure class

Background: Checksum mismatch errors: "checksum verification failed", "digest mismatch", "expected vs actual checksum" — what they mean and how to fix them — this error's family across 41 libraries.

Related errors


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

Appendix: source

Thrown at scripts/release/assemble-release-assets.js:76

      `${label} does not match the authoritative inventory` +
        `${missing.length > 0 ? `; missing: ${missing.join(", ")}` : ""}` +
        `${unexpected.length > 0 ? `; unexpected: ${unexpected.join(", ")}` : ""}` +
        `${actual.size !== actualNames.length ? "; duplicate basenames are present" : ""}`,
    );
  }
}

async function assertManifest(directory, manifestName, expectedNames) {
  const manifestPath = path.join(directory, manifestName);
  const checksums = parseChecksumManifest(
    await fs.readFile(manifestPath, "utf8"),
    manifestName,
  );
  assertExactNames([...checksums.keys()], expectedNames, manifestName);
  for (const name of expectedNames) {
    const actual = await sha256(path.join(directory, name));
    if (checksums.get(name) !== actual) {
      throw new Error(`${manifestName} checksum mismatch for ${name}`);
    }
  }
}

async function verifyAssetDirectory(directory) {
  const entries = await fs.readdir(directory, { withFileTypes: true });
  const nonFiles = entries.filter((entry) => !entry.isFile());
  if (nonFiles.length > 0) {
    throw new Error(
      `Release asset directory must be flat; found: ${nonFiles.map((entry) => entry.name).join(", ")}`,
    );
  }

  const expected = allReleaseAssetNames();
  assertExactNames(entries.map((entry) => entry.name), expected, "Release asset directory");
  await assertManifest(directory, CHECKSUM_MANIFEST, checksummedReleaseAssetNames());
  await assertManifest(directory, BUNDLE_CHECKSUM_MANIFEST, BUNDLE_ASSET_NAMES);
  console.log(`Verified ${expected.length} release assets in ${directory}`);

View on GitHub (pinned to 433685b202)