Crosstalk-Solutions/project-nomad · error · Error

Failed to download tar file

Error message

Failed to download tar file

What it means

Thrown by MapService.downloadBaseAssets after a retrying download of the base map assets tarball: once the retry helper finishes, the code checks that the temp tar file exists on disk (getFileStatsIfExists) and throws if it was never created/kept. It means every download attempt failed or the file was cleaned up before verification.

Source

Thrown at admin/app/services/map_service.ts:118

    const defaultTarFileURL = new URL(
      this.baseAssetsTarFile,
      'https://github.com/Crosstalk-Solutions/project-nomad-maps/raw/refs/heads/master/'
    )

    const resolvedURL = url ? new URL(url) : defaultTarFileURL
    await doResumableDownloadWithRetry({
      url: resolvedURL.toString(),
      filepath: tempTarPath,
      timeout: 30000,
      max_retries: 2,
      allowedMimeTypes: BASE_ASSETS_MIME_TYPES,
      onAttemptError(error, attempt) {
        console.error(`Attempt ${attempt} to download tar file failed: ${error.message}`)
      },
    })
    const tarFileBuffer = await getFileStatsIfExists(tempTarPath)
    if (!tarFileBuffer) {
      throw new Error(`Failed to download tar file`)
    }

    await extract({
      cwd: join(process.cwd(), this.mapStoragePath),
      file: tempTarPath,
      strip: 1,
    })

    await deleteFileIfExists(tempTarPath)

    // Invalidate cache since we just downloaded new assets
    this.baseAssetsExistCache = true

    return true
  }

  async downloadCollection(slug: string): Promise<string[] | null> {
    const manifestService = new CollectionManifestService()

View on GitHub (pinned to 0bd1c6f4f9)

Solutions

  1. Check the preceding console.error 'Attempt N to download tar file failed' lines for the root network cause
  2. Verify egress connectivity to the assets URL from the host (curl -I <tar-url>)
  3. Free space on the tmp/docs volume and confirm write permissions for the temp tar path
  4. Configure HTTP(S)_PROXY correctly if behind a corporate proxy
  5. Retry once network is restored — the operation is idempotent-ish (old extracted assets are only replaced on success)

Example fix

// before
await mapService.downloadBaseAssets() // throws: Failed to download tar file

// after
// verify reachability first
await assertReachable(ASSETS_URL) // curl-equivalent check
await mapService.downloadBaseAssets()
Defensive patterns

Strategy: retry

Validate before calling

import { request } from 'undici'
try { await request(ASSETS_TAR_URL, { method: 'HEAD' }) } catch { /* pre-check */ throw new Error('assets CDN unreachable') }

Try / catch

let lastErr: unknown
for (let i = 0; i < 3; i++) {
  try { await mapService.downloadBaseAssets(); break }
  catch (e) {
    lastErr = e
    if ((e as Error).message !== 'Failed to download tar file') throw e
    await sleep(30_000 * (i + 1))
  }
}
if (lastErr) throw lastErr

Prevention

When it happens

Trigger: Calling downloadBaseAssets when the assets URL is unreachable, network egress is blocked, disk is full so the temp file can't be written, or the retry helper swallows failures and returns without writing tempTarPath.

Common situations: Offline/air-gapped environments, firewall blocking the CDN hosting the map tarball, misconfigured proxy env vars, full tmp volume, DNS failures — console.error shows per-attempt messages before this throw.

Related errors


AI-assisted analysis of Crosstalk-Solutions/project-nomad@0bd1c6f4f9 (2026-08-27). Data as JSON: /api/errors/60413e1c261c5fa0. Report an issue: GitHub.