{"record":{"id":"1fe510ac560d434f","repo":"jdx/mise","slug":"resource-name-missing-url","errorCode":null,"errorMessage":"resource #{name}: missing url","messagePattern":"resource #(.+?): missing url","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"src/system/packages/brew/shim.rb","lineNumber":418,"sourceCode":"  def version(version = nil)\n    @version = version unless version.nil?\n    @version || (@url && Version.new(@url[/[0-9]+(?:\\.[0-9]+)+/].to_s))\n  end\n\n  def mirror(url) = (@mirrors ||= []) << url\n  def using = @specs[:using]\n  def livecheck(&) = nil\n\n  def patch(*, &)\n    # building against an unpatched resource silently produces a wrong\n    # artifact — refuse instead\n    shim_unsupported!(\"resource patches\")\n  end\n\n  # unpack into `target` (or a tmpdir) and run the optional block there\n  def stage(target = nil, &block)\n    shim_unsupported!(\"resource with download strategy #{using.inspect}\") unless using.nil?\n    raise \"resource #{name}: missing url\" if @url.nil?\n    archive = MiseDownload.fetch(@url, @sha256, \"resource #{name}\")\n    if target\n      target = Pathname.new(target.to_s)\n      stage_dir = Pathname.new(Dir.mktmpdir(\"mise-resource-\"))\n      root = MiseDownload.unpack(archive, stage_dir)\n      target.mkpath\n      FileUtils.cp_r(\"#{root}/.\", target.to_s)\n      FileUtils.remove_entry(stage_dir)\n      block&.call(self)\n    else\n      raise \"resource #{name}: stage requires a target or a block\" unless block\n      Dir.mktmpdir(\"mise-resource-\") do |dir|\n        root = MiseDownload.unpack(archive, Pathname.new(dir))\n        Dir.chdir(root) { block.call(self) }\n      end\n    end\n  end\nend","sourceCodeStart":400,"sourceCodeEnd":436,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/system/packages/brew/shim.rb#L400-L436","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Add a url to the resource block in the formula","Check for typos in the resource DSL keys (url vs urls)","Confirm the formula version you're using declares the resource url","If the resource intentionally has no url, drop it — the shim can't stage it"],"exampleFix":"# before\nresource \"libfoo\" do\n  version \"1.2.3\"\n  sha256 \"abc\"\nend\n# after\nresource \"libfoo\" do\n  url \"https://example.com/libfoo-1.2.3.tar.gz\"\n  version \"1.2.3\"\n  sha256 \"abc\"\nend","handlingStrategy":"validation","validationCode":"raise \"resource #{name} missing url\" if resource.url.nil?","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always declare url in every resource block","Lint formula resources for required keys before install","Port resource DSL completely when copying Homebrew formulas"],"tags":["ruby","download","resource"],"backgroundTag":"missing-required-config-field","analyzedSha":"afd2eddd3a50c16190efc1c7e94404b48f72af57","analyzedAt":"2026-09-09T01:38:25.179Z","contentChangedAt":"2026-09-09T01:38:25.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}