jdx/mise · error

brew-cask:{}: unsupported archive type for {}

Error message

brew-cask:{}: unsupported archive type for {}

What it means

After download, mise determines an ExtractionFormat for the archive (by cask hints and content sniffing). If the format is neither Raw (a single staged file) nor a supported archive type, extraction cannot proceed and mise aborts. This means the downloaded artifact's format isn't one of the container formats mise can unpack for casks.

Source

Thrown at src/system/packages/brew/cask/fetch.rs:294

        .and_then(|f| f.to_str())
        .unwrap_or_default();
    if is_dmg_archive(archive, filename)? {
        file::un_dmg(archive, &extract_dir)?;
    } else {
        let format = cask_extraction_format(archive, filename)?;
        if format == ExtractionFormat::Raw {
            // A direct pkg download may have an opaque URL path while the response's
            // Content-Disposition and the cask artifact supply its real name. Stage
            // XAR installers under the declared artifact name; other raw downloads
            // are executable binaries and retain the original URL filename.
            let (stage_filename, executable) = raw_cask_artifact_name(cask, archive, filename)?;
            let dest = extract_dir.join(stage_filename);
            file::copy(archive, &dest)?;
            if executable {
                file::make_executable(&dest)?;
            }
        } else if !format.is_archive() {
            bail!(
                "brew-cask:{}: unsupported archive type for {}",
                cask.token,
                filename
            );
        } else {
            file::extract_archive(
                archive,
                &extract_dir,
                format,
                &ExtractOptions {
                    pr,
                    ..Default::default()
                },
            )?;
        }
    }
    extract_nested_cask_archives(&extract_dir, pr)?;
    Ok(extract_dir)

View on GitHub (pinned to afd2eddd3a)

Solutions

  1. Verify the URL actually serves the intended artifact (a 404/HTML body breaks format detection); fix the URL or proxy in the cask metadata.
  2. Update the cask definition to the currently published artifact format, or switch to an alternate URL mise supports (zip/tar/dmg/git).
  3. Install the app via the brew CLI directly if it requires an installer type mise does not unpack.
  4. Clear the download cache and retry in case a truncated/corrupt cached archive caused misdetection.

Example fix

// before (unsupported container)
"url": "https://example.com/myapp.custominstaller"
// after
"url": "https://example.com/myapp.zip"
Defensive patterns

Strategy: try-catch

Validate before calling

file myapp.zip && file --mime-type myapp.zip  # confirm the URL serves a supported archive before wiring it into a cask

Try / catch

// Rust caller
match install_cask(token) {
    Err(e) if e.to_string().contains("unsupported archive type") => {
        eprintln!("artifact format unsupported; install via `brew install --cask {token}` instead");
    }
    Err(e) => return Err(e),
    Ok(v) => Ok(v),
}

Prevention

When it happens

Trigger: extract_archive (via fetch_and_stage) encounters a cask artifact whose detected format reports is_archive() == false and is not Raw — e.g. an installer format mise does not support, or a file whose content doesn't match any known archive signature.

Common situations: A cask pointing at a .pkg/.mpkg or other installer type outside the supported set; the URL serving an HTML error page instead of the archive so sniffing fails; upstream changed the artifact format (e.g. zip → proprietary container); cask stanza (url/appcast) out of sync with the actual file.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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