{"record":{"id":"15f90f372404993c","repo":"jdx/mise","slug":"command-failed-args-join","errorCode":null,"errorMessage":"command failed: #{args.join(\" \")}","messagePattern":"command failed: #(.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"src/system/packages/brew/shim.rb","lineNumber":116,"sourceCode":"    case archive.basename.to_s\n    when /\\.(tar\\.(gz|xz|bz2|zst)|tgz|txz|tbz2?|tar|crate)\\z/i\n      system_or_die \"tar\", \"xf\", archive.to_s, \"-C\", dest.to_s\n    when /\\.zip\\z/i\n      system_or_die \"unzip\", \"-qo\", archive.to_s, \"-d\", dest.to_s\n    when /\\.(gz|xz|bz2)\\z/i\n      data = `#{archive.to_s =~ /xz\\z/ ? \"xz -dc\" : archive.to_s =~ /bz2\\z/ ? \"bzip2 -dc\" : \"gzip -dc\"} #{Shellwords.escape(archive.to_s)}`\n      raise \"failed to decompress #{archive}\" unless $?.success?\n      (dest + archive.basename.to_s.sub(/\\.(gz|xz|bz2)\\z/i, \"\")).binwrite(data)\n    else\n      FileUtils.cp archive, dest\n    end\n    entries = dest.children\n    return entries.first if entries.size == 1 && entries.first.directory?\n    dest\n  end\n\n  def system_or_die(*args)\n    raise \"command failed: #{args.join(\" \")}\" unless system(*args)\n  end\nend\n\nmodule OS\n  def self.mac? = RbConfig::CONFIG[\"host_os\"].include?(\"darwin\")\n  def self.linux? = RbConfig::CONFIG[\"host_os\"].include?(\"linux\")\n\n  module Mac\n    def self.version = MacOSVersion.host\n  end\n\n  module Linux\n    def self.languages = [\"en\"]\n  end\nend\n\nclass MacOSVersion\n  include Comparable","sourceCodeStart":98,"sourceCodeEnd":134,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/system/packages/brew/shim.rb#L98-L134","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Install the missing tool: apt-get install -y tar unzip (or the distro equivalent).","Verify the archive type with `file archive` matches its extension; fix the package URL/extension if mislabeled.","Check destination writability and free disk space in MISE_BREW_CACHE.","Test extraction manually (tar xf <archive> -C <dest>) to see the underlying tar/unzip error message."],"exampleFix":"// before (unzip missing)\n# command failed: unzip -qo /cache/tool.zip -d /cache/out\n// after\nRUN apt-get update && apt-get install -y unzip","handlingStrategy":"validation","validationCode":"# check required extraction tools before running installs\n%w[tar unzip].each do |t|\n  raise \"missing tool: #{t}\" unless system(\"command -v #{t}\", out: File::NULL)\nend","typeGuard":null,"tryCatchPattern":"begin\n  MiseDownload.unpack(archive, dest)\nrescue RuntimeError => e\n  raise unless e.message.start_with?(\"command failed:\")\n  # inspect missing binary / disk space / archive validity, then retry\nend","preventionTips":["Ensure tar and unzip are installed in minimal containers before mise package installs.","Verify archive integrity and extension/type agreement with `file`.","Keep the cache directory writable with adequate free space."],"tags":["ruby","subprocess","archive","brew"],"backgroundTag":"command-not-found","analyzedSha":"afd2eddd3a50c16190efc1c7e94404b48f72af57","analyzedAt":"2026-09-09T01:38:25.179Z","contentChangedAt":"2026-09-09T01:38:25.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}