BoundaryML/baml · error · FetchError

disk error: {0}

Error message

disk error: {0}

What it means

FetchError::Io wraps a std::io::Error (via #[from]) raised during the non-network parts of a release operation — writing the downloaded archive to disk, creating directories, or extracting files. The underlying OS error message is interpolated so the developer sees the real cause (permissions, disk full, etc.).

Source

Thrown at baml_language/crates/baml_release/src/lib.rs:101

        status: reqwest::StatusCode,
    },
    #[error("manifest 404 for version {version} (not released yet?)")]
    ManifestNotFound { version: String },
    #[error("manifest schema {got} not supported (max {max}); run `baml self-update`")]
    ManifestSchemaTooNew { got: u32, max: u32 },
    #[error("target {target} not built for version {version}")]
    TargetNotInManifest { target: String, version: String },
    #[error("sha256 mismatch for {url}: expected {expected}, got {got}")]
    ChecksumMismatch {
        url: String,
        expected: String,
        got: String,
    },
    #[error("archive missing expected binary {name}")]
    BinaryNotInArchive { name: String },
    #[error("archive contains unsafe path {path}")]
    UnsafeArchivePath { path: String },
    #[error("disk error: {0}")]
    Io(#[from] std::io::Error),
    #[error("zip archive error: {0}")]
    Zip(#[from] zip::result::ZipError),
}

#[derive(Debug, Clone)]
pub struct Fetcher {
    pub spec: ReleaseSpec,
    pub product: Product,
    pub manifest_base_url: String,
    pub release_repo: String,
    artifact: Option<Artifact>,
}

impl Fetcher {
    pub fn default_for(spec: ReleaseSpec, product: Product) -> Self {
        Self {
            spec,

View on GitHub (pinned to bd85ce9dee)

Solutions

  1. Read the wrapped io::Error message for the exact OS cause (permission, no space, etc.)
  2. Check free disk space (df -h) if the message indicates ENOSPC
  3. Fix permissions on the install directory or choose a user-writable prefix
  4. Ensure the destination isn't read-only (container/CI volume mounts)
  5. Retry if the failure was transient (e.g. AV briefly locking the file)

Example fix

# before
$ sudo baml self-update --install-dir /usr/local/bin  # runs as root, fine
$ baml self-update --install-dir /usr/local/bin  # EACCES
disk error: Permission denied (os error 13)
# after
$ baml self-update --install-dir ~/.local/bin && export PATH=~/.local/bin:$PATH
Defensive patterns

Strategy: try-catch

Validate before calling

// pre-check writability and space before install
let dir = install_dir();
let probe = dir.join(".baml-write-test");
std::fs::write(&probe, b"").map_err(|e| eprintln!("{dir} not writable: {e}"))?;
let _ = std::fs::remove_file(&probe);

Type guard

fn is_io_err(e: &FetchError) -> Option<&std::io::Error> {
    if let FetchError::Io(io) = e { Some(io) } else { None }
}

Try / catch

match install(v) {
    Err(FetchError::Io(e)) if e.kind() == std::io::ErrorKind::PermissionDenied => {
        eprintln!("no write access to install dir; use --install-dir ~/.local/bin");
        std::process::exit(1);
    }
    Err(FetchError::Io(e)) => {
        warn!("transient disk error: {e}; retrying");
        retry_once_or_fail()
    }
    other => other,
}

Prevention

When it happens

Trigger: Any baml_release install/self-update call where writing the temp archive, creating the install directory, or extracting entries fails with an OS-level I/O error (EACCES, ENOSPC, ENOENT).

Common situations: Installing into a directory without write permission (e.g. a system path without sudo), a full disk or full /tmp, the install target being read-only in containers, or antivirus locking the destination file on Windows.

Understand the failure class

Background: "failed to write file", "Could not save figure", "Error saving remote file" — file write failed: causes and fixes across languages and libraries — this error's family across 38 libraries.

Related errors


AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12). Data as JSON: /api/errors/1c61267063b20f37. Report an issue: GitHub.