jdx/mise · error · RuntimeError
command failed: #{pretty}
Error message
command failed: #{pretty} What it means
The shim overrides Kernel#system so formula scripts get ohai logging and fail-fast semantics. It raises when the invoked command exits non-zero, halting the formula's install at the first failing command with the full command line in the message.
Source
Thrown at src/system/packages/brew/shim.rb:745
def deps = []
def declared_deps = []
def resource(name)
res = self.class.resources.fetch(name) { raise "undefined resource #{name.inspect}" }
res.owner = self
res
end
def resources = self.class.resources.values.each { |r| r.owner = self }
# ---- build helpers ----
def system(cmd, *args)
args = args.map(&:to_s)
pretty = ([cmd] + args).join(" ")
ohai pretty
# single-string invocations go through the shell, like Kernel#system
ok = Kernel.system(cmd.to_s, *args)
raise "command failed: #{pretty}" unless ok
end
def quiet_system(cmd, *args)
Kernel.system(cmd.to_s, *args.map(&:to_s), out: File::NULL, err: File::NULL)
end
def which(cmd)
ENV.fetch("PATH", "").split(File::PATH_SEPARATOR).each do |dir|
candidate = Pathname.new(dir) + cmd.to_s
return candidate if candidate.executable? && candidate.file?
end
nil
end
def inreplace(paths, before = nil, after = nil, audit_result = true, &block)
Array(paths).each do |path|
path = Pathname.new(path.to_s)
content = path.readView on GitHub (pinned to afd2eddd3a)
Solutions
- Run the failing command manually in the stage dir to see its full error output
- Install or expose the missing build dependency the command needs
- Fix wrong flags/paths in the formula's system(...) invocation
- Use quiet_system or inreplace alternatives where shell behavior differs
Example fix
# before system "make", "install" # after raise "make install failed" unless quiet_system "make", "install" system "make", "install"
Defensive patterns
Strategy: try-catch
Validate before calling
# preflight: ensure required tools exist before running formula build
%w[make gcc].each { |t| raise "missing tool #{t}" unless system("which", t, out: File::NULL) } Try / catch
begin
system "make", "install"
rescue RuntimeError => e
warn "install step failed: #{e.message}"
raise
end Prevention
- Run failing commands manually in the stage dir for full output
- Declare/verify all build dependencies before build steps
- Avoid commands that assume Homebrew-specific env vars
- Keep command flags current with the tool version being built
When it happens
Trigger: Any build/test/install command invoked via system(...) that exits with a failure status: missing build tool, configure script error, failing make target, missing interpreter, bad flags.
Common situations: Build dependencies not present in the shim environment; configure detecting a missing library and exiting 1; commands assuming Homebrew paths (e.g. HOMEBREW_PREFIX) that the shim doesn't provide; typo'd flags in the formula.
Related errors
- brew-cask: failed to generate {} completions from {}: {}
- systemctl {} failed: {}
- command failed: #{args.join(" ")}
- patch failed:\n#{output}
- completion generation failed: #{cmd.join(" ")}
AI-assisted analysis of jdx/mise@afd2eddd3a (2026-09-09).
Data as JSON: /api/errors/45360f33de15116a.
Report an issue: GitHub.