openai/codex · error · anyhow::Error

curl download failed with

Error message

curl download failed with {status}

What it means

download_dmg: the `curl -fL --retry 3` download of the desktop-app installer DMG finished with a non-zero exit status (HTTP error, unreachable host, or write failure). curl already retried three times before this surfaced.

Solutions

  1. Check network connectivity and retry later
  2. Verify the download URL is reachable
  3. Map the curl exit status to its cause in the curl man page
  4. Ensure the destination path is writable
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at codex-rs/cli/src/desktop_app/mac.rs:253 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of openai/codex@339751715c (2026-08-25). Data as JSON: /api/errors/dd381214976f0377. Report an issue: GitHub.

Appendix: source

Thrown at codex-rs/cli/src/desktop_app/mac.rs:253

async fn download_dmg(url: &str, dest: &Path) -> anyhow::Result<()> {
    eprintln!("Downloading installer...");
    let status = Command::new("curl")
        .arg("-fL")
        .arg("--retry")
        .arg("3")
        .arg("--retry-delay")
        .arg("1")
        .arg("-o")
        .arg(dest)
        .arg(url)
        .status()
        .await
        .context("failed to invoke `curl`")?;

    if status.success() {
        return Ok(());
    }
    anyhow::bail!("curl download failed with {status}");
}

async fn mount_dmg(dmg_path: &Path) -> anyhow::Result<PathBuf> {
    let output = Command::new("hdiutil")
        .arg("attach")
        .arg("-nobrowse")
        .arg("-readonly")
        .arg(dmg_path)
        .output()
        .await
        .context("failed to invoke `hdiutil attach`")?;

    if !output.status.success() {
        anyhow::bail!(
            "`hdiutil attach` failed with {status}: {stderr}",
            status = output.status,
            stderr = String::from_utf8_lossy(&output.stderr)
        );

View on GitHub (pinned to 339751715c)