louis-e/arnis · error

Failed to fetch data

Error message

Failed to fetch data

What it means

In run_cli, the Overpass fetch is the fallible path: retrieve_data::fetch_data_from_overpass returns Result<OsmData, Box<dyn Error>>, and the CLI unwraps it with .expect("Failed to fetch data"). The function tries multiple Overpass servers (Arnis mirror plus public instances) with several downloaders (reqwest/curl/wget) and gives up only when every server/attempt fails — network outage, DNS failure, HTTP 429/5xx, timeouts, or an unparseable response.

Source

Thrown at src/main.rs:369

            (ground, t.elapsed())
        });

        let t = std::time::Instant::now();
        // A local file was already parsed up front (to derive the bbox), so reuse that data.
        // Terrain-only carries no objects. Otherwise fetch from Overpass, in parallel with the
        // Overture and land-cover fetches spawned above.
        let raw_data = if skip_objects {
            osm_parser::OsmData::empty()
        } else if let Some(data) = preloaded_osm.take() {
            data
        } else {
            retrieve_data::fetch_data_from_overpass(
                effective_bbox,
                args.debug,
                args.downloader.as_str(),
                args.save_json_file.as_deref(),
            )
            .expect("Failed to fetch data")
        };
        bench.report("osm_fetch", t.elapsed());

        // A panicked worker already reported itself through the panic hook, so
        // degrade instead of taking the whole run down with it.
        let (overture_data, overture_dur) = overture_handle.join().unwrap_or_else(|_| {
            eprintln!(
                "{} Overture fetch failed, continuing without Overture buildings.",
                "Warning:".yellow().bold()
            );
            (overture::OvertureData::default(), std::time::Duration::ZERO)
        });
        bench.report("overture_fetch", overture_dur);
        let (ground, ground_dur) = ground_handle.join().unwrap_or_else(|_| {
            eprintln!("{} Terrain fetch failed.", "Error:".red().bold());
            std::process::exit(1);
        });
        bench.report("terrain_total", ground_dur);

View on GitHub (pinned to 34048924d9)

Solutions

  1. Re-run later or reduce the bounding box size — public Overpass servers are rate-limited and often overloaded
  2. Switch downloader with --downloader curl (or wget) if reqwest is blocked by TLS/proxy issues
  3. Check connectivity/DNS and any proxy env vars (HTTP_PROXY/HTTPS_PROXY); test one endpoint manually with curl
  4. Use --save-json-file with a previously downloaded dump, or preload a local OSM JSON file so no network fetch happens
  5. Consider self-hosting or using an alternative Overpass mirror if the default endpoints keep failing

Example fix

// before
./arnis --bbox 48.10,11.55,48.16,11.60 --downloader reqwest
// after: smaller area and alternate downloader, saving the raw JSON
./arnis --bbox 48.12,11.57,48.14,11.59 --downloader curl --save-json-file munich.json
Defensive patterns

Strategy: retry

Validate before calling

fn overpass_reachable() -> bool {
    std::process::Command::new("curl")
        .args(["-sf", "-m", "10",
               "https://api.arnismc.com/overpass/api/interpreter?data=[out:json];out;"])
        .output().map(|o| o.status.success()).unwrap_or(false)
}

Try / catch

match retrieve_data::fetch_data_from_overpass(bbox, debug, downloader, save_file) {
    Ok(data) => data,
    Err(e) => {
        eprintln!("Overpass fetch failed: {e}");
        eprintln!("Retrying with curl after backoff...");
        // exponential backoff retry, then fall back to a local JSON file
        retry_or_load_cached(bbox)?
    }
}

Prevention

When it happens

Trigger: Calling the CLI (run_cli, from main) with an online fetch when: no internet/DNS resolution fails; all Overpass endpoints return 429 (rate-limited) or 504 (server overload, common for large bboxes); the configured downloader ('reqwest', 'curl', 'wget') is unavailable or blocked by a proxy/firewall; the response is not valid Overpass JSON/XML so parse_overoverpass_response fails.

Common situations: Generating a world for a very large bounding box that times out on public Overpass instances; running during an Overpass maintenance window; corporate proxy blocking the requests; spamming retries and getting rate-limited; typo in --downloader so the external tool isn't found.

Related errors


AI-assisted analysis of louis-e/arnis@34048924d9 (2026-09-03). Data as JSON: /api/errors/9b67bfb29284b044. Report an issue: GitHub.