{"record":{"id":"fd3ebd13c7ca90c4","repo":"Yeachan-Heo/oh-my-codex","slug":"native-assets-temporary-checksum-verification-fa","errorCode":null,"errorMessage":"[native-assets] temporary checksum verification failed","messagePattern":"\\[native-assets\\] temporary checksum verification failed","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/cli/native-assets.ts","lineNumber":646,"sourceCode":"    await validateDescendant(destination, root, false);\n    await validateDescendant(sidecarPath(destination), root, false);\n    await validateDescendant(lock.path, root, false);\n    await validateDescendant(tempBinary, root, false);\n    await validateDescendant(tempSidecar, root, false);\n  };\n  let primaryError: unknown;\n  try {\n    await revalidatePublicationPaths();\n    const existing = await inspectManagedNativeBinary(destination, env);\n    if (existing.state === 'verified') return existing.path;\n    await copyFile(source, tempBinary, constants.COPYFILE_EXCL);\n    await revalidatePublicationPaths();\n    if (platform !== 'win32') await chmod(tempBinary, 0o755);\n    const binary = await readOpenedFile(tempBinary, true, true);\n    const sidecar = `${binary.digest}\\n`;\n    const handle = await open(tempSidecar, constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL | constants.O_NOFOLLOW, 0o600);\n    try { await handle.writeFile(sidecar, 'utf8'); } finally { await handle.close(); }\n    if ((await readOpenedFile(tempSidecar, true, false, MAX_SIDECAR_BYTES)).text !== sidecar) throw new Error('[native-assets] temporary checksum verification failed');\n    await revalidatePublicationPaths();\n    await quarantineInvalid(destination);\n    await revalidatePublicationPaths();\n    await quarantineInvalid(sidecarPath(destination));\n    await revalidatePublicationPaths();\n    await rename(tempBinary, destination);\n    await revalidatePublicationPaths();\n    await rename(tempSidecar, sidecarPath(destination));\n    await revalidatePublicationPaths();\n    const final = await inspectManagedNativeBinary(destination, env);\n    await revalidatePublicationPaths();\n    if (final.state !== 'verified') throw new Error(`[native-assets] cache publication verification failed: ${final.state}`);\n    return final.path;\n  } catch (error) {\n    primaryError = error;\n    throw error;\n  } finally {\n    const cleanupFailures: string[] = [];","sourceCodeStart":628,"sourceCodeEnd":664,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/cli/native-assets.ts#L628-L664","documentation":"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.","triggerScenarios":"publishManagedNativeBinary when readOpenedFile(tempSidecar).text !== the digest string just written — disk errors, quota, or external processes mutating temp files mid-publication.","commonSituations":"Disk-full or flaky storage under the cache; antivirus/sync tools touching temp files; NFS coherence issues.","solutions":["Free space / repair the volume under the cache root.","Exclude the cache directory from antivirus and file-sync tools.","Retry hydration; a clean retry usually succeeds after environmental fixes."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { await hydrateNativeBinary(); } catch (e) { if (/temporary checksum verification failed/.test(String(e))) { await rm(cacheRoot, { recursive: true, force: true }); return hydrateNativeBinary(); } throw e; }","preventionTips":["Keep the cache volume healthy and non-full","Exclude cache dirs from sync/antivirus","Retry after clearing the cache"],"tags":["native-assets","sidecar","checksum","filesystem"],"backgroundTag":"file-corruption","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}