jdx/mise · error · RuntimeError

cannot install # : does not exist

Error message

cannot install #{src}: does not exist

What it means

The brew shim's `install_one` moves a built source file or symlink into its destination during formula installation. It raises when the source path neither exists nor is a symlink, meaning the build/stage step failed to produce the expected artifact before the move.

Solutions

  1. Check the formula's install block and confirm the src path matches the actual staged artifact layout (ls the stage dir).
  2. Verify the download/unpack step succeeded and the archive contains the expected files (checksum and archive structure).
  3. If upstream moved the artifact, update the formula path to the new location.
  4. Wrap the build in verbose mode to see which step failed to produce the file before the move.

Example fix

# before
install_one "bin/#{name}-old", bin
# after
install_one "bin/#{name}", bin  # upstream renamed the binary
Defensive patterns

Strategy: validation

Validate before calling

src = Pathname.new(candidate)
raise "staged artifact missing: #{src}" unless src.exist? || src.symlink?
install_one(src, dest)

Try / catch

begin
  install_one(src, dest)
rescue RuntimeError => e
  raise unless e.message.start_with?("cannot install")
  # inspect stage dir, re-run or fail install
end

Prevention

When it happens

Trigger: Calling install (which fans out to install_one) with a src path that was never created — e.g. the unpacked archive layout differs from what the formula's install block expects, a build step silently skipped writing the binary, or an incorrect path string is passed.

Common situations: Upstream renamed or relocated the binary between releases so the formula copies from a stale path; a partially failed download produced an empty stage directory; typos in the install block's path handling inside a Homebrew formula running under mise's brew shim.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/772c7fa249bc1231. Report an issue: GitHub.

Appendix: source

Thrown at src/system/packages/brew/shim.rb:239

end

# Pathname extensions mirroring brew's
class Pathname
  def install(*sources)
    mkpath
    sources.flatten.each do |src|
      case src
      when Hash
        src.each { |from, to| install_one(from, self + to) }
      else
        install_one(src, self + Pathname.new(src.to_s).basename)
      end
    end
  end

  def install_one(src, dest)
    src = Pathname.new(src.to_s)
    raise "cannot install #{src}: does not exist" unless src.exist? || src.symlink?
    dest.dirname.mkpath
    FileUtils.mv src.to_s, dest.to_s
  end
  private :install_one

  def install_symlink(*sources)
    mkpath
    sources.flatten.each do |src|
      case src
      when Hash
        src.each { |from, to| make_relative_symlink(Pathname.new(from.to_s), self + to) }
      else
        src = Pathname.new(src.to_s)
        make_relative_symlink(src, self + src.basename)
      end
    end
  end

View on GitHub (pinned to 533346cc37)