{"record":{"id":"50d4b01adc73fada","repo":"moeru-ai/airi","slug":"failed-to-download-mediapipe-vision-task-asset-for","errorCode":null,"errorMessage":"Failed to download MediaPipe vision task asset for ${key} after ${attempt} attempts","messagePattern":"Failed to download MediaPipe vision task asset for (.+?) after (.+?) attempts","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/model-driver-mediapipe/tasks/prepare-tasks.ts","lineNumber":75,"sourceCode":"      await fs.writeFile(tempPath, Buffer.from(response))\n      await fs.rename(tempPath, outputPath)\n      console.log(`MediaPipe vision task asset for ${key} saved to ${outputPath}`)\n    }\n    finally {\n      await fs.rm(tempPath, { force: true })\n    }\n  }, {\n    onError: (error) => {\n      const message = errorMessageFromValue(error)\n      console.warn(`Failed to download MediaPipe vision task asset for ${key} (attempt ${attempt}): ${message}`)\n    },\n  })\n\n  try {\n    await downloadWithRetry()\n  }\n  catch (error) {\n    throw new Error(`Failed to download MediaPipe vision task asset for ${key} after ${attempt} attempts`, {\n      cause: error,\n    })\n  }\n}\n\nawait fs.mkdir(assetsRoot, { recursive: true })\n\nfor (const { key, source, outputPath } of taskTargets) {\n  if (await isUsableFile(outputPath)) {\n    console.log(`MediaPipe vision task asset for ${key} already exists at ${outputPath}, skipping download.`)\n    continue\n  }\n  await downloadAsset(key, source, outputPath)\n\n  if (!await isUsableFile(outputPath))\n    throw new Error(`Failed to ensure MediaPipe vision task asset for ${key}: missing or empty file at ${outputPath}`)\n}\n","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/moeru-ai/airi/blob/677329427f32468c74b17f3ec47eeca4e05bec65/packages/model-driver-mediapipe/tasks/prepare-tasks.ts#L57-L93","documentation":"prepare-tasks.ts is the package's asset-preparation script (run as a task before dev/build) that downloads MediaPipe vision task model files (pose/hands/face .task assets) into the package's assets directory. Each downloadAsset call wraps a retrying downloader; when every attempt fails (network error, DNS, proxy block, 4xx/5xx), it rethrows with this message and the last underlying error attached as cause. The script skips already-present usable files, so this only fires when the asset genuinely cannot be fetched.","triggerScenarios":"Running pnpm -F @proj-airi/model-driver-mediapipe dev/build (or any pipeline invoking tasks/prepare-tasks.ts) on a machine without internet access; behind a corporate proxy that blocks jsdelivr/Google-hosted model files; a mistyped or moved upstream model URL in taskTargets; CI runner with flaky egress.","commonSituations":"Offline development or air-gapped CI; corporate MITM proxies rejecting large binary downloads; the upstream CDN URL changed between package versions; intermittent network during long CI runs.","solutions":["Fix network egress for the model CDN the script downloads from, then re-run the task — the retry wrapper will try again from scratch.","Check the console.warn lines emitted per attempt (they include the underlying errorMessageFromValue) to identify DNS vs HTTP status vs proxy errors.","Pre-seed the asset: place a valid, non-empty .task file at the expected outputPath (printed in the error context / taskTargets) so the isUsableFile check skips the download.","If you maintain the package, verify each taskTargets source URL still resolves (curl -I) and update it."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Cache the prepared assets directory on CI so model downloads rarely re-run.","Pre-seed assets in air-gapped environments by copying a known-good .task file to the expected outputPath (script skips existing usable files).","Watch the per-attempt console.warn lines to distinguish DNS, proxy, and HTTP-status failures before re-running."],"tags":["mediapipe","build","download","network","assets"],"backgroundTag":"asset-download-failed","analyzedSha":"677329427f32468c74b17f3ec47eeca4e05bec65","analyzedAt":"2026-08-18T17:29:58.153Z","contentChangedAt":"2026-08-18T17:29:58.153Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}