jdx/mise · error · RuntimeError

resource #{name}: missing url

Error message

resource #{name}: missing url

What it means

Resource#stage downloads and unpacks a formula's additional resource. The shim raises when the resource has no url set, because there is nothing to fetch via MiseDownload.fetch. In Homebrew, a resource without a URL is only valid in limited internal contexts; the shim requires one.

Source

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

  def version(version = nil)
    @version = version unless version.nil?
    @version || (@url && Version.new(@url[/[0-9]+(?:\.[0-9]+)+/].to_s))
  end

  def mirror(url) = (@mirrors ||= []) << url
  def using = @specs[:using]
  def livecheck(&) = nil

  def patch(*, &)
    # building against an unpatched resource silently produces a wrong
    # artifact — refuse instead
    shim_unsupported!("resource patches")
  end

  # unpack into `target` (or a tmpdir) and run the optional block there
  def stage(target = nil, &block)
    shim_unsupported!("resource with download strategy #{using.inspect}") unless using.nil?
    raise "resource #{name}: missing url" if @url.nil?
    archive = MiseDownload.fetch(@url, @sha256, "resource #{name}")
    if target
      target = Pathname.new(target.to_s)
      stage_dir = Pathname.new(Dir.mktmpdir("mise-resource-"))
      root = MiseDownload.unpack(archive, stage_dir)
      target.mkpath
      FileUtils.cp_r("#{root}/.", target.to_s)
      FileUtils.remove_entry(stage_dir)
      block&.call(self)
    else
      raise "resource #{name}: stage requires a target or a block" unless block
      Dir.mktmpdir("mise-resource-") do |dir|
        root = MiseDownload.unpack(archive, Pathname.new(dir))
        Dir.chdir(root) { block.call(self) }
      end
    end
  end
end

View on GitHub (pinned to afd2eddd3a)

Solutions

  1. Add a url to the resource block in the formula
  2. Check for typos in the resource DSL keys (url vs urls)
  3. Confirm the formula version you're using declares the resource url
  4. If the resource intentionally has no url, drop it — the shim can't stage it

Example fix

# before
resource "libfoo" do
  version "1.2.3"
  sha256 "abc"
end
# after
resource "libfoo" do
  url "https://example.com/libfoo-1.2.3.tar.gz"
  version "1.2.3"
  sha256 "abc"
end
Defensive patterns

Strategy: validation

Validate before calling

raise "resource #{name} missing url" if resource.url.nil?

Prevention

When it happens

Trigger: Defining a resource block with only a version/sha256 but omitting url; constructing a Resource programmatically without assigning @url before calling stage; resource blocks that rely on an unsupported download strategy short-circuit first.

Common situations: Ported formula code where the url was filled in by a newer Homebrew DSL; typo'd url key in a resource block; resources copied from formulae where url is injected by a helper the shim doesn't implement.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


AI-assisted analysis of jdx/mise@afd2eddd3a (2026-09-09). Data as JSON: /api/errors/1fe510ac560d434f. Report an issue: GitHub.