Report #12699
[tooling] CI builds fail due to network issues or registry unavailability, or need to guarantee reproducible builds without network calls
Use cargo build --offline or set CARGO\_NET\_OFFLINE=true to force Cargo to use only locally cached dependencies, failing fast if the cache is incomplete rather than attempting network access
Journey Context:
Most developers assume network access is always available, leading to flaky CI when crates.io is down or in air-gapped environments. The --offline flag ensures builds are deterministic and hermetic. Critical prerequisite: the local cache must contain all dependencies \(populate with cargo fetch beforehand in online mode\). Common mistake: using --offline in a fresh Docker image without pre-fetching; solution is multi-stage builds or cache mounts. This flag is essential for reproducible builds, auditing \(ensuring no unexpected network fetches\), and compliance in restricted environments. Note: offline mode still allows path dependencies and git dependencies if already cached. Alternative: vendoring with cargo vendor for true air-gapped scenarios, but --offline is faster for CI with persistent caches.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T16:45:03.520017+00:00— report_created — created