Crosstalk-Solutions/project-nomad · error · Error

No internet — connect to download FDA drug data. (${msg})

Error message

No internet — connect to download FDA drug data. (${msg})

What it means

Thrown by fetchManifest() when the underlying network error message matches known offline signatures: ENOTFOUND, ECONNREFUSED, ECONNRESET, or 'fetch failed'. It converts the raw Node fetch failure into a user-friendly 'no internet' error before rethrowing non-network errors unchanged.

Source

Thrown at admin/app/jobs/download_drug_data_job.ts:323

   * offline-error translation.
   */
  static async fetchManifest(): Promise<DrugLabelManifest> {
    let json: unknown
    try {
      const resp = await fetch(MANIFEST_URL)
      if (!resp.ok) {
        throw new Error(`HTTP ${resp.status} from ${MANIFEST_URL}`)
      }
      json = await resp.json()
    } catch (err) {
      const msg = err instanceof Error ? err.message : String(err)
      if (
        msg.includes('ENOTFOUND') ||
        msg.includes('ECONNREFUSED') ||
        msg.includes('ECONNRESET') ||
        msg.includes('fetch failed')
      ) {
        throw new Error(`No internet — connect to download FDA drug data. (${msg})`)
      }
      throw err
    }
    return parseDrugLabelManifest(json)
  }

  private async writeDownloadState(
    manifest: DrugLabelManifest,
    totalParts: number,
    parts: DownloadStateMarker['parts']
  ): Promise<void> {
    const KVStore = (await import('#models/kv_store')).default
    const marker: DownloadStateMarker = {
      export_date: manifest.export_date,
      totalParts,
      totalRecords: manifest.total_records,
      parts,
      completedAtMs: Date.now(),

View on GitHub (pinned to 0bd1c6f4f9)

Solutions

  1. Verify connectivity: ping api.fda.gov or curl -I https://api.fda.gov and restore network/DNS.
  2. Check firewall/proxy rules allowing HTTPS to the FDA host; set HTTPS_PROXY if a proxy is required.
  3. If running on a schedule, ensure the device is online at job time or pause the scheduler when offline.
  4. Re-run the Download FDA data job once connectivity is confirmed.

Example fix

// before
throw new Error(`No internet — connect to download FDA drug data. (${msg})`)

// after — surface the original cause for diagnostics
throw new Error(`No internet — connect to download FDA drug data. (${msg})`, { cause: err })
Defensive patterns

Strategy: retry

Validate before calling

import { lookup } from 'node:dns/promises'
async function online(host: string): Promise<boolean> {
  try { await lookup(host); return true } catch { return false }
}

Try / catch

catch (err) {
  if (err instanceof Error && err.message.includes('No internet')) {
    // pause scheduler, resume on 'online' event; safe to retry later
  }
  throw err
}

Prevention

When it happens

Trigger: DNS resolution failure (ENOTFOUND), connection refused by firewall/proxy (ECONNREFUSED), dropped connection (ECONNRESET), or undici's generic 'fetch failed' wrapper when the machine has no route to the FDA host.

Common situations: Device offline when the scheduled download job runs, firewall blocking outbound HTTPS, misconfigured DNS, VPN dropped mid-request, air-gapped or lab environment.

Related errors


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