jdx/mise · error · RuntimeError

command failed: #

Error message

command failed: #{args.join(" ")}

What it means

A Ruby raise in the brew shim's system_or_die helper: an external command (tar, unzip, etc. invoked from unpack) returned non-zero. The helper joins the argument list into the message so the failing command is visible.

Solutions

  1. Read the exact command in the message and run it manually to see the underlying stderr
  2. Install the missing tool (e.g. `apt-get install -y unzip` or rely on bsdtar)
  3. Delete the bad cached archive and re-download (the checksum check will catch corruption)
  4. Check write permissions on the extraction destination directory

Example fix

// before
$ unzip -qo archive.zip -d dest  # unzip: command not found
// after
$ apt-get install -y unzip && mise retry
Defensive patterns

Strategy: try-catch

Validate before calling

raise "tar missing" unless system("which", "tar")
raise "unzip missing" unless system("which", "unzip") if archive.end_with?(".zip")

Try / catch

begin
  MiseDownload.unpack(archive, dest)
rescue RuntimeError => e
  warn "#{e.message} — run the command manually for stderr"
end

Prevention

When it happens

Trigger: tar failing on a corrupt/unsupported archive format, unzip failing on an encrypted or damaged zip, the destination directory not existing or being unwritable, or the tool (tar/unzip) missing from PATH.

Common situations: Minimal Docker images without unzip; archives with platform-incompatible flags (e.g. xz-compressed tars on systems lacking xz); permission issues in the extraction destination.

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/15f90f372404993c. Report an issue: GitHub.

Appendix: source

Thrown at src/system/packages/brew/shim.rb:116

    case archive.basename.to_s
    when /\.(tar\.(gz|xz|bz2|zst)|tgz|txz|tbz2?|tar|crate)\z/i
      system_or_die "tar", "xf", archive.to_s, "-C", dest.to_s
    when /\.zip\z/i
      system_or_die "unzip", "-qo", archive.to_s, "-d", dest.to_s
    when /\.(gz|xz|bz2)\z/i
      data = `#{archive.to_s =~ /xz\z/ ? "xz -dc" : archive.to_s =~ /bz2\z/ ? "bzip2 -dc" : "gzip -dc"} #{Shellwords.escape(archive.to_s)}`
      raise "failed to decompress #{archive}" unless $?.success?
      (dest + archive.basename.to_s.sub(/\.(gz|xz|bz2)\z/i, "")).binwrite(data)
    else
      FileUtils.cp archive, dest
    end
    entries = dest.children
    return entries.first if entries.size == 1 && entries.first.directory?
    dest
  end

  def system_or_die(*args)
    raise "command failed: #{args.join(" ")}" unless system(*args)
  end
end

module OS
  def self.mac? = RbConfig::CONFIG["host_os"].include?("darwin")
  def self.linux? = RbConfig::CONFIG["host_os"].include?("linux")

  module Mac
    def self.version = MacOSVersion.host
  end

  module Linux
    def self.languages = ["en"]
  end
end

class MacOSVersion
  include Comparable

View on GitHub (pinned to 533346cc37)