Yeachan-Heo/oh-my-codex · error · Error

[native-assets] temporary checksum verification failed

Error message

[native-assets] temporary checksum verification failed

What it means

The temporary .sha256 sidecar written during publication didn't read back identical to what was written. This self-check (bounded by MAX_SIDECAR_BYTES) guards against corrupt sidecars before the rename-based atomic publication of binary+checksum into the cache.

Source

Thrown at src/cli/native-assets.ts:646

    await validateDescendant(destination, root, false);
    await validateDescendant(sidecarPath(destination), root, false);
    await validateDescendant(lock.path, root, false);
    await validateDescendant(tempBinary, root, false);
    await validateDescendant(tempSidecar, root, false);
  };
  let primaryError: unknown;
  try {
    await revalidatePublicationPaths();
    const existing = await inspectManagedNativeBinary(destination, env);
    if (existing.state === 'verified') return existing.path;
    await copyFile(source, tempBinary, constants.COPYFILE_EXCL);
    await revalidatePublicationPaths();
    if (platform !== 'win32') await chmod(tempBinary, 0o755);
    const binary = await readOpenedFile(tempBinary, true, true);
    const sidecar = `${binary.digest}\n`;
    const handle = await open(tempSidecar, constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL | constants.O_NOFOLLOW, 0o600);
    try { await handle.writeFile(sidecar, 'utf8'); } finally { await handle.close(); }
    if ((await readOpenedFile(tempSidecar, true, false, MAX_SIDECAR_BYTES)).text !== sidecar) throw new Error('[native-assets] temporary checksum verification failed');
    await revalidatePublicationPaths();
    await quarantineInvalid(destination);
    await revalidatePublicationPaths();
    await quarantineInvalid(sidecarPath(destination));
    await revalidatePublicationPaths();
    await rename(tempBinary, destination);
    await revalidatePublicationPaths();
    await rename(tempSidecar, sidecarPath(destination));
    await revalidatePublicationPaths();
    const final = await inspectManagedNativeBinary(destination, env);
    await revalidatePublicationPaths();
    if (final.state !== 'verified') throw new Error(`[native-assets] cache publication verification failed: ${final.state}`);
    return final.path;
  } catch (error) {
    primaryError = error;
    throw error;
  } finally {
    const cleanupFailures: string[] = [];

View on GitHub (pinned to 3ad79a8a6f)

Solutions

  1. Free space / repair the volume under the cache root.
  2. Exclude the cache directory from antivirus and file-sync tools.
  3. Retry hydration; a clean retry usually succeeds after environmental fixes.
Defensive patterns

Strategy: retry

Try / catch

try { await hydrateNativeBinary(); } catch (e) { if (/temporary checksum verification failed/.test(String(e))) { await rm(cacheRoot, { recursive: true, force: true }); return hydrateNativeBinary(); } throw e; }

Prevention

When it happens

Trigger: publishManagedNativeBinary when readOpenedFile(tempSidecar).text !== the digest string just written — disk errors, quota, or external processes mutating temp files mid-publication.

Common situations: Disk-full or flaky storage under the cache; antivirus/sync tools touching temp files; NFS coherence issues.

Related errors


AI-assisted analysis of Yeachan-Heo/oh-my-codex@3ad79a8a6f (2026-08-27). Data as JSON: /api/errors/fd3ebd13c7ca90c4. Report an issue: GitHub.