jdx/mise · info

download cancelled by user

Error message

download cancelled by user

What it means

While streaming a download to disk, mise checks a cancellation flag after each received chunk. When the user has signalled cancellation (e.g. Ctrl+C), the transfer stops and this error is raised so the partial download can be kept for later resume. It is an intentional user-initiated abort, not a fault.

Source

Thrown at src/http.rs:1105

            }

            if let Some(pr) = pr {
                if let Some(total_size) = total_size {
                    pr.set_length(total_size);
                }
                pr.set_position(write_offset);
            }
            let mut file = tokio::fs::OpenOptions::new()
                .create(true)
                .write(true)
                .append(write_offset > 0)
                .truncate(write_offset == 0)
                .open(&partial.path)
                .await?;
            let transfer = async {
                while let Some(chunk) = resp.chunk().await? {
                    if crate::ui::ctrlc::is_cancelled() {
                        bail!("download cancelled by user");
                    }
                    file.write_all(&chunk).await?;
                    bytes_received.fetch_add(chunk.len() as u64, Ordering::Relaxed);
                    if let Some(pr) = pr {
                        pr.inc(chunk.len() as u64);
                    }
                }
                Ok::<_, Report>(())
            }
            .await;
            // Outside the transfer, so it also runs when the transfer failed.
            // `tokio::fs::File` buffers writes and dropping one does not flush,
            // so a transfer that dies part way through was leaving the bytes it
            // had already received unwritten — the resume then asked for a range
            // starting before them and downloaded them again. Whether any of it
            // survived depended on when the background flush happened to land.
            let persisted = async {
                file.shutdown().await?;

View on GitHub (pinned to afd2eddd3a)

Solutions

  1. Re-run the install when ready — mise resumes from the partial download.
  2. If this appears in a non-interactive script, avoid sending SIGINT to mise or run it in a detached process.
  3. Use --raw/offline-style options or pre-fetch artifacts if downloads are too slow.
Defensive patterns

Strategy: try-catch

Try / catch

match install().await {
    Err(e) if e.to_string().contains("download cancelled by user") => {
        // expected on Ctrl+C; partial download is kept for resume
        eprintln!("install interrupted; re-run to resume");
    }
    other => other?,
}

Prevention

When it happens

Trigger: Pressing Ctrl+C (or otherwise setting the crate::ui::ctrlc cancelled flag) during any mise tool/artifact download; the chunk loop in the download transfer detects it and bails.

Common situations: User interrupts a slow or large download to try again later; a script times out and sends SIGINT to a mise install; terminal disconnect during a long install.

Related errors


AI-assisted analysis of jdx/mise@afd2eddd3a (2026-09-09). Data as JSON: /api/errors/1b8fe53e909d0e92. Report an issue: GitHub.