jdx/mise · error · RuntimeError

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

Error message

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

What it means

system_or_die is the brew shim's helper for running external commands; it raises when Kernel#system returns falsy, i.e. the command could not be spawned or exited non-zero. unpack uses it for tar and unzip, so this error surfaces whenever archive extraction fails.

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 afd2eddd3a)

Solutions

  1. Install the missing tool: apt-get install -y tar unzip (or the distro equivalent).
  2. Verify the archive type with `file archive` matches its extension; fix the package URL/extension if mislabeled.
  3. Check destination writability and free disk space in MISE_BREW_CACHE.
  4. Test extraction manually (tar xf <archive> -C <dest>) to see the underlying tar/unzip error message.

Example fix

// before (unzip missing)
# command failed: unzip -qo /cache/tool.zip -d /cache/out
// after
RUN apt-get update && apt-get install -y unzip
Defensive patterns

Strategy: validation

Validate before calling

# check required extraction tools before running installs
%w[tar unzip].each do |t|
  raise "missing tool: #{t}" unless system("command -v #{t}", out: File::NULL)
end

Try / catch

begin
  MiseDownload.unpack(archive, dest)
rescue RuntimeError => e
  raise unless e.message.start_with?("command failed:")
  # inspect missing binary / disk space / archive validity, then retry
end

Prevention

When it happens

Trigger: unpack calls system_or_die 'tar', 'xf', ... or 'unzip', ... and tar/unzip is missing from PATH, the archive format doesn't match the extension (e.g. zip content named .tar.gz), or the destination is unwritable/full.

Common situations: Slim container images without tar or unzip; mislabeled archives; corrupted downloads passing checksum only if the recorded checksum matches the corrupt file; read-only cache directories.

Related errors


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