jdx/mise · error · RuntimeError
completion generation failed: #{cmd.join(" ")}
Error message
completion generation failed: #{cmd.join(" ")} What it means
The shim's completion generator builds a command to ask the tool itself to emit shell completions (including click-style env-var completion), runs it via Open3.capture2, and raises if the process exits non-zero. The generated output is then written into the completion directory.
Source
Thrown at src/system/packages/brew/shim.rb:853
shells.each do |shell|
completion_dir = { bash: bash_completion, zsh: zsh_completion, fish: fish_completion }.fetch(shell)
file_name = { bash: base_name, zsh: "_#{base_name}", fish: "#{base_name}.fish" }.fetch(shell)
shell_arg = case shell_parameter_format
when nil then shell.to_s
when :flag then "--#{shell}"
when :arg then "--shell=#{shell}"
when :none then nil
when :click then nil # click uses env vars; handled below
when String then "#{shell_parameter_format}#{shell}"
end
cmd = commands.map(&:to_s)
cmd << shell_arg unless shell_arg.nil?
env = {}
if shell_parameter_format == :click
env["_#{base_name.upcase.tr("-", "_")}_COMPLETE"] = "#{shell}_source"
end
output, status = Open3.capture2(env, *cmd)
raise "completion generation failed: #{cmd.join(" ")}" unless status.success?
completion_dir.mkpath
(completion_dir + file_name).write(output)
end
end
def time = Time.now
def post_install; end
# unknown instance helpers: fail loudly
def method_missing(name, *args, &block)
shim_unsupported!("#{name} (install-time helper)")
end
def respond_to_missing?(_name, _include_private = false) = true
class InreplaceText
attr_reader :textView on GitHub (pinned to afd2eddd3a)
Solutions
- Run the completion command manually to see the tool's error output
- Check the shell name is one the tool supports (bash/zsh/fish) and matches the installed tool version
- For click tools, verify base_name matches the click program so the env var name is right
- Update the formula to a tool version that supports the requested shell/format
Example fix
# before shell_completion :nushell, "mytool" # after shell_completion :bash, "mytool" # or :zsh/:fish, per tool support
Defensive patterns
Strategy: try-catch
Validate before calling
# preflight: confirm the tool supports the shell
supported = %w[bash zsh fish]
raise "unsupported shell #{shell}" unless supported.include?(shell.to_s) Try / catch
begin
generate_completions(shell)
rescue RuntimeError => e
raise unless e.message.start_with?("completion generation failed")
warn "completion generation failed for #{shell}: #{e.message}"
end Prevention
- Confirm the installed tool version supports the requested shell
- For click tools, keep base_name aligned with the click program name
- Run the tool's completion command manually when a formula install fails here
When it happens
Trigger: The tool's completion subcommand fails: wrong shell name passed, unsupported shell_parameter_format, tool version lacking the completion command, or the completion binary errors at runtime.
Common situations: Formula declaring shell_completion with a shell name the tool doesn't support (e.g. :nushell on older versions); click-based tools where the base_name-derived env var doesn't match the actual click program name; PATH issues during install.
Related errors
- brew-cask: failed to generate {} completions from {}: {}
- brew-cask: failed to generate {} completions from {}: {}
- command failed: #{args.join(" ")}
- patch failed:\n#{output}
- command failed: #{pretty}
AI-assisted analysis of jdx/mise@afd2eddd3a (2026-09-09).
Data as JSON: /api/errors/b5f5032276e6152f.
Report an issue: GitHub.