{"record":{"id":"5033474c453e90fa","repo":"jdx/mise","slug":"undefined-resource-name-inspect","errorCode":null,"errorMessage":"undefined resource #{name.inspect}","messagePattern":"undefined resource #(.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"src/system/packages/brew/shim.rb","lineNumber":731,"sourceCode":"  def doc = share + \"doc\" + name\n  def info = share + \"info\"\n  def bash_completion = prefix + \"etc/bash_completion.d\"\n  def zsh_completion = share + \"zsh/site-functions\"\n  def fish_completion = share + \"fish/vendor_completions.d\"\n  def pkgetc = etc + name\n\n  # etc/var live in the prefix, outside the keg (survive upgrades)\n  def etc = MISE_BREW_PREFIX + \"etc\"\n  def var = MISE_BREW_PREFIX + \"var\"\n\n  def buildpath = MISE_BREW_BUILDPATH\n  def testpath = shim_unsupported!(\"testpath\")\n\n  def deps = []\n  def declared_deps = []\n\n  def resource(name)\n    res = self.class.resources.fetch(name) { raise \"undefined resource #{name.inspect}\" }\n    res.owner = self\n    res\n  end\n\n  def resources = self.class.resources.values.each { |r| r.owner = self }\n\n  # ---- build helpers ----\n  def system(cmd, *args)\n    args = args.map(&:to_s)\n    pretty = ([cmd] + args).join(\" \")\n    ohai pretty\n    # single-string invocations go through the shell, like Kernel#system\n    ok = Kernel.system(cmd.to_s, *args)\n    raise \"command failed: #{pretty}\" unless ok\n  end\n\n  def quiet_system(cmd, *args)\n    Kernel.system(cmd.to_s, *args.map(&:to_s), out: File::NULL, err: File::NULL)","sourceCodeStart":713,"sourceCodeEnd":749,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/system/packages/brew/shim.rb#L713-L749","documentation":"Formula#resource looks up a named Resource declared on the formula's class via self.class.resources. It raises when the requested name isn't in that map, i.e. the formula never declared a resource with that name (or the name is misspelled).","triggerScenarios":"Calling resource(\"name\") during install for a resource not declared in the formula; misspelled resource name; resources declared only for a different stable/head block so they're absent at install time.","commonSituations":"Formula refactors that removed a resource while install blocks still reference it; version-conditional resource declarations where the installed version lacks the resource; typos between resource declarations and uses.","solutions":["Declare the resource in the formula: resource \"name\" do ... end","Fix the name used in resource(...) to match the declared resource exactly","Check the resource is declared in the version branch being installed","Use resources to list available resource names for debugging"],"exampleFix":"# before\nresource(\"my-data\").stage(pkgshare)\n# after\nresource \"my-data\" do\n  url \"https://example.com/my-data.tar.gz\"\n  sha256 \"abc\"\nend\n# ...then in install:\nresource(\"my-data\").stage(pkgshare)","handlingStrategy":"validation","validationCode":"unless formula.class.resources.key?(\"my-data\")\n  raise \"formula #{formula.name} does not declare resource my-data\"\nend","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep resource declarations and resource(...) uses in sync","Grep formulas for resource( calls and verify each name is declared","Watch out for version-conditional resource blocks"],"tags":["ruby","resource","formula"],"backgroundTag":"resource-not-found","analyzedSha":"afd2eddd3a50c16190efc1c7e94404b48f72af57","analyzedAt":"2026-09-09T01:38:25.179Z","contentChangedAt":"2026-09-09T01:38:25.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}