{"record":{"id":"d9da86d8b9a72fbf","repo":"Yeachan-Heo/oh-my-codex","slug":"native-assets-downloaded-archive-size-mismatch-f","errorCode":null,"errorMessage":"[native-assets] downloaded archive size mismatch for ${asset.archive}","messagePattern":"\\[native-assets\\] downloaded archive size mismatch for (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/cli/native-assets.ts","lineNumber":735,"sourceCode":"  const extractedBinaryPath = join(tempRoot, 'native-binary');\n\n  try {\n    for (let index = 0; index < assets.length; index += 1) {\n      const asset = assets[index]!;\n      const archivePath = join(tempRoot, asset.archive);\n      const cachedBinaryPath = resolveCachedNativeBinaryPath(\n        product,\n        version,\n        platform,\n        arch,\n        env,\n        inferNativeAssetLibc(asset),\n      );\n      try {\n        await downloadFile(asset.download_url, archivePath);\n        const archiveStat = await stat(archivePath);\n        if (typeof asset.size === 'number' && asset.size > 0 && archiveStat.size !== asset.size) {\n          throw new Error(`[native-assets] downloaded archive size mismatch for ${asset.archive}`);\n        }\n        const digest = await sha256ForFile(archivePath);\n        if (digest !== asset.sha256) {\n          throw new Error(`[native-assets] checksum mismatch for ${asset.archive}`);\n        }\n\n        const archiveEntries = await inspectNativeArchive(archivePath);\n        const archiveBinary = selectNativeArchiveBinary(archiveEntries, asset.binary_path);\n        await writeSelectedNativeArchiveMember(archivePath, archiveBinary.path, extractedBinaryPath);\n\n        const published = await publishManagedNativeBinary(extractedBinaryPath, cachedBinaryPath, platform, env);\n        if (published) return published;\n        throw new Error(`[native-assets] cache publication verification failed for ${cachedBinaryPath}`);\n      } catch (error) {\n        if (index < assets.length - 1 && isUnavailableArchiveError(error)) {\n          await rm(archivePath, { force: true });\n          await rm(extractedBinaryPath, { force: true });\n          continue;","sourceCodeStart":717,"sourceCodeEnd":753,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/cli/native-assets.ts#L717-L753","documentation":"The downloaded release archive's on-disk size does not match the size declared in the release manifest. This is the first integrity gate after downloadFile; a size mismatch means a truncated or altered download and the asset is rejected before checksum verification/extraction.","triggerScenarios":"hydrateNativeBinary downloading an asset whose manifest-listed size is a positive number but stat(archivePath).size differs — truncated transfers through proxies, HTML error pages saved instead of the archive, or a manifest published with stale sizes.","commonSituations":"Corporate proxies truncating large binaries; mirrors whose assets differ from upstream; releases where the manifest was regenerated without re-uploading assets.","solutions":["Delete the partial archive (the library also cleans on retry) and re-run hydration on a stable network.","Bypass/fix truncating proxies; verify by curl-ing the asset URL and comparing Content-Length with the manifest.","If the release itself is bad, report/re-publish the manifest+assets so sizes agree."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"async function sizeMatches(url: string, expected: number): Promise<boolean> { const r = await fetch(url, { method: 'HEAD' }); return r.ok && Number(r.headers.get('content-length')) === expected; }","typeGuard":null,"tryCatchPattern":"try { await hydrateNativeBinary(); } catch (e) { if (/archive size mismatch/.test(String(e))) { /* re-download on stable network / check proxy truncation */ } throw e; }","preventionTips":["Use a stable network for first hydration","Bypass binary-truncating proxies","Vendor pre-hydrated caches in CI images"],"tags":["native-assets","download","size-mismatch","integrity"],"backgroundTag":"download-integrity-check-failed","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}