{"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/533346cc374382b41ec5ff70536252b2e96e725c/src/system/packages/brew/shim.rb#L98-L134","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Read the exact command in the message and run it manually to see the underlying stderr","Install the missing tool (e.g. `apt-get install -y unzip` or rely on bsdtar)","Delete the bad cached archive and re-download (the checksum check will catch corruption)","Check write permissions on the extraction destination directory"],"exampleFix":"// before\n$ unzip -qo archive.zip -d dest  # unzip: command not found\n// after\n$ apt-get install -y unzip && mise retry","handlingStrategy":"try-catch","validationCode":"raise \"tar missing\" unless system(\"which\", \"tar\")\nraise \"unzip missing\" unless system(\"which\", \"unzip\") if archive.end_with?(\".zip\")","typeGuard":null,"tryCatchPattern":"begin\n  MiseDownload.unpack(archive, dest)\nrescue RuntimeError => e\n  warn \"#{e.message} — run the command manually for stderr\"\nend","preventionTips":["Pre-install tar/unzip/xz in build images","Reproduce the failing command manually to see hidden stderr (backticks/system hide it)","Confirm extraction destination exists and is writable","Checksum-verify archives before extraction"],"tags":["ruby","command-failed","archive","extraction"],"backgroundTag":"command-not-found","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}