moeru-ai/airi · error · Error

Failed to download MediaPipe vision task asset for

Error message

Failed to download MediaPipe vision task asset for ${key} after ${attempt} attempts

What it means

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.

Solutions

  1. Fix network egress for the model CDN the script downloads from, then re-run the task — the retry wrapper will try again from scratch.
  2. Check the console.warn lines emitted per attempt (they include the underlying errorMessageFromValue) to identify DNS vs HTTP status vs proxy errors.
  3. 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.
  4. If you maintain the package, verify each taskTargets source URL still resolves (curl -I) and update it.
Defensive patterns

Strategy: retry

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of moeru-ai/airi@677329427f (2026-08-18). Data as JSON: /api/errors/50d4b01adc73fada. Report an issue: GitHub.

Appendix: source

Thrown at packages/model-driver-mediapipe/tasks/prepare-tasks.ts:75

      await fs.writeFile(tempPath, Buffer.from(response))
      await fs.rename(tempPath, outputPath)
      console.log(`MediaPipe vision task asset for ${key} saved to ${outputPath}`)
    }
    finally {
      await fs.rm(tempPath, { force: true })
    }
  }, {
    onError: (error) => {
      const message = errorMessageFromValue(error)
      console.warn(`Failed to download MediaPipe vision task asset for ${key} (attempt ${attempt}): ${message}`)
    },
  })

  try {
    await downloadWithRetry()
  }
  catch (error) {
    throw new Error(`Failed to download MediaPipe vision task asset for ${key} after ${attempt} attempts`, {
      cause: error,
    })
  }
}

await fs.mkdir(assetsRoot, { recursive: true })

for (const { key, source, outputPath } of taskTargets) {
  if (await isUsableFile(outputPath)) {
    console.log(`MediaPipe vision task asset for ${key} already exists at ${outputPath}, skipping download.`)
    continue
  }
  await downloadAsset(key, source, outputPath)

  if (!await isUsableFile(outputPath))
    throw new Error(`Failed to ensure MediaPipe vision task asset for ${key}: missing or empty file at ${outputPath}`)
}

View on GitHub (pinned to 677329427f)