{"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/533346cc374382b41ec5ff70536252b2e96e725c/src/system/packages/brew/shim.rb#L400-L436","documentation":"Homebrew shim's Resource#stage path: the embedded brew Formula DSL shim does not implement full resource download strategies, and a resource defined without a url cannot be staged or version-inferred by the shim, so it refuses rather than producing a wrong artifact.","triggerScenarios":"Declaring `resource \"name\" do ... end` without a `url` directive and then calling `stage(target)` or `stage { |r| ... }` on it.","commonSituations":"Copy-pasted resource blocks where the url line was dropped; formula updates where upstream removed a sub-component but the formula still stages it; conditional resources defined only in one branch but staged unconditionally.","solutions":["Add the missing `url` (and matching `sha256`) to the resource block in the formula.","Remove the resource and its stage call if the component is no longer needed.","If the url is conditional, ensure the stage call is inside the same condition."],"exampleFix":"# before\nresource \"libfoo\" do\n  version \"1.2\"\nend\n# after\nresource \"libfoo\" do\n  url \"https://example.com/libfoo-1.2.tar.gz\"\n  sha256 \"abc123...\"\n  version \"1.2\"\nend","handlingStrategy":"validation","validationCode":"raise \"resource #{r.name}: no url\" if r.url.nil?  # before calling stage","typeGuard":null,"tryCatchPattern":"begin\n  resource.stage(target)\nrescue RuntimeError => e\n  raise unless e.message.include?(\"missing url\")\n  # add url to resource or skip\nend","preventionTips":["Always declare url + sha256 together when adding resources","Lint formulas for resource blocks lacking url","Keep resources conditional together with their stage calls"],"tags":["ruby","brew-shim","resource","download"],"backgroundTag":"missing-required-config-field","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}