jdx/mise · error · eyre::Report

`docker load` failed ({}): {}. Ensure the docker daemon is r

Error message

`docker load` failed ({}): {}. Ensure the docker daemon is running and your user has access to the socket.

What it means

After streaming the docker archive, mise checks the `docker load` child's exit status; non-zero triggers this error with the status, docker's stderr, and — when the archive writer also failed (e.g. a layer that will not decompress) — an extra `(while writing archive: ...)` line so the root cause is not masked (src/oci/docker_archive.rs:113).

Source

Thrown at src/oci/docker_archive.rs:113

        .join()
        .map_err(|_| eyre::eyre!("docker archive writer thread panicked"))?;

    if !out.status.success() {
        let stderr = String::from_utf8_lossy(&out.stderr);
        let mut msg = format!(
            "`docker load` failed ({}): {}. Ensure the docker daemon is running and \
             your user has access to the socket.",
            out.status,
            stderr.trim()
        );
        // A write error here is usually the broken pipe caused by docker
        // dying (so docker's stderr is the real cause), but if it's something
        // else — e.g. a layer failed to decompress — surface it too so the
        // truncated-archive error from docker doesn't mask the root cause.
        if let Err(e) = &write_result {
            msg.push_str(&format!("\n(while writing archive: {e})"));
        }
        bail!(msg);
    }
    // docker succeeded — don't swallow a writer error if one somehow occurred.
    write_result?;
    Ok(())
}

fn write_docker_archive<W: Write>(
    out: W,
    layout: &ImageLayout,
    manifest: &ImageManifest,
    config_bytes: &[u8],
    tag: &str,
) -> Result<()> {
    let mut builder = Builder::new(out);

    let config_name = format!("{}.json", hex_of(&manifest.config.digest));
    append_bytes(&mut builder, &config_name, config_bytes)?;

View on GitHub (pinned to 6f52dcdf99)

Solutions

  1. Verify docker works: `docker ps`; if it fails, start the daemon (`systemctl start docker` or launch Docker Desktop)
  2. Fix socket permissions: `sudo usermod -aG docker $USER` then log out/in
  3. If the message includes `(while writing archive: ...)`, treat that as the cause: rebuild the image (`mise oci build`) — the layer blob is corrupt

Example fix

# before
mise oci run   # docker load failed
# after
sudo systemctl start docker
docker ps   # verify access
mise oci run
Defensive patterns

Strategy: retry

Validate before calling

#!/usr/bin/env bash
docker info >/dev/null 2>&1 || { echo 'docker daemon unreachable — start it before mise oci run' >&2; exit 1; }
mise oci run

Try / catch

# Retry once after ensuring the daemon is reachable (CI service startup race):
for i in 1 2; do
  docker info >/dev/null 2>&1 && mise oci run && break
  [ "$i" = 2 ] && { echo 'docker never became ready' >&2; exit 1; }
  # host wait primitive, not sleep: block until the socket answers
  timeout 30 bash -c 'until docker info >/dev/null 2>&1; do read -t 1 -u 1 || true; done'
done

Prevention

When it happens

Trigger: `mise oci run` when the docker daemon is not running (`Cannot connect to the Docker daemon`), the user lacks socket permission (`permission denied ... /var/run/docker.sock`), or a layer blob in the image dir is corrupt so docker dies mid-stream.

Common situations: Fresh machines where docker isn't started; user not in the docker group; Docker Desktop not launched; CI without a docker service; image dirs damaged by partial copies or interrupted builds.

Related errors


AI-assisted analysis of jdx/mise@6f52dcdf99 (2026-08-22). Data as JSON: /api/errors/e76e9f1536e62172. Report an issue: GitHub.