{"record":{"id":"126a3a6318e78c30","repo":"jdx/mise","slug":"formula-uses-feature-which-mise-s-source-bui","errorCode":null,"errorMessage":"formula uses `#{feature}`, which mise's source-build shim does not support","messagePattern":"formula uses `#(.+?)`, which mise's source-build shim does not support","errorType":"exception","errorClass":"ShimUnsupportedError","httpStatus":null,"severity":"error","filePath":"src/system/packages/brew/shim.rb","lineNumber":63,"sourceCode":"\ndef ohai(*args)\n  $stdout.puts \"==> #{args.join(\" \")}\"\n  $stdout.flush\nend\n\ndef opoo(message)\n  $stderr.puts \"Warning: #{message}\"\nend\n\ndef odie(message)\n  $stderr.puts \"Error: #{message}\"\n  exit 1\nend\n\nclass ShimUnsupportedError < StandardError; end\n\ndef shim_unsupported!(feature)\n  raise ShimUnsupportedError,\n        \"formula uses `#{feature}`, which mise's source-build shim does not support\"\nend\n\nmodule MiseDownload\n  module_function\n\n  # download with redirects into the cache, verify, return the path\n  def fetch(url, sha256, context)\n    raise \"#{context}: missing sha256\" if sha256.to_s.strip.empty?\n    sha256 = sha256.to_s.strip.downcase\n    raise \"#{context}: malformed sha256\" unless sha256.match?(/\\A[0-9a-f]{64}\\z/)\n\n    MISE_BREW_CACHE.mkpath\n    dest = MISE_BREW_CACHE + \"#{sha256}--#{File.basename(URI(url).path)}\"\n    unless dest.file? && Digest::SHA256.file(dest).hexdigest == sha256\n      ohai \"Downloading #{url}\"\n      tmp = Pathname.new(\"#{dest}.incomplete\")\n      URI.open(url, \"rb\", redirect: true) do |remote|","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/jdx/mise/blob/6bd4a54fadcdf3a6757cc44061a9528b48dd2ae7/src/system/packages/brew/shim.rb#L45-L81","documentation":"mise can source-build Homebrew formulae without Homebrew by evaluating the formula's .rb in its own Formula-DSL shim (shim.rb, invoked from src/system/packages/brew/source.rs). It implements 'the commonly-used subset of the Formula DSL; formulae that reach outside it fail loudly with a clear message rather than miscompiling silently' (file header). When a formula's install code uses something outside that subset, `shim_unsupported!` raises ShimUnsupportedError with `formula uses \\`X\\`, which mise's source-build shim does not support`. Concrete raisers in shim.rb: resource patches (line 405), resources declaring a non-nil download strategy `using:` (line 410), unknown `on_system :macos =>` condition symbols (line 614), inline `patch` strings via `:DATA`-style sources (line 659), `testpath` (line 718), and any unknown install-time helper method called inside `def install` (line 858).","triggerScenarios":"Source-building a formula through mise's brew system-packages integration (e.g. `mise use brew:<formula>` when no bottle is poured/available, or a build mode that forces source) where the formula's `install` block or its resources/patches use unsupported DSL: a `resource do ... using: :git ... end`, a `test do testpath ... end` referenced at install time, a patch with an inline string source, or a helper method the shim never defined.","commonSituations":"Linux machines or containers source-building formulae that Homebrew serves as bottles on macOS; niche formulae with git/cvs resources or heavy patch sets; a formula update in homebrew/core suddenly adopting a new DSL method the shim lacks; build-from-source forced by settings or missing bottles for the platform.","solutions":["Update mise to the newest release first — the shim's DSL subset expands as formulae require it","Install the formula with real Homebrew (`brew install <formula>`) so the full Formula DSL is available, or use a tool backend that ships binaries (aqua/github releases) instead of source-building the brew formula","If bottles exist for your platform, let mise pour the bottle rather than source-building (bottle pour paths don't evaluate install code and never hit this shim)","Inspect the formula (github.com/Homebrew/homebrew-core/blob/HEAD/Formula/<first-letter>/<formula>.rb) to find the offending stanza and file an issue at github.com/jdx/mise naming the formula so support can be added"],"exampleFix":"# before (source-build shim rejects the formula's DSL)\nmise use brew:niche-formula\n# after (real Homebrew handles full DSL)\nbrew install niche-formula","handlingStrategy":"fallback","validationCode":"# before source-building, check the formula for DSL the shim rejects\nruby -e '\n  src = File.read(ARGV[0])\n  abort \"uses testpath in install\" if src.match?(/^\\s*def install.*?testpath/m)\n  abort \"uses inline patch (:DATA)\" if src.include?(\"patch :DATA\") || src.match?(/patch\\s+do\\s*\\n\\s*s\\s*=/)\n  abort \"resource uses download strategy\" if src.match?(/using:\\s*:/)\n' Formula/foo.rb 2>/dev/null || echo \"formula likely needs real brew\"","typeGuard":"# ruby: formula source is shim-compatible when no flagged constructs appear\nFORMULA_SHIM_UNSUPPORTED = [\n  /testpath/,\n  /patch\\s+:DATA/,\n  /using:\\s*:/,          # resource download strategies\n  /patch\\s+(\"|')/,       # inline patch strings\n  /on_system\\s+:macos\\s*=>\\s*:(?!ventura_or_older|ventura_or_newer|sonoma_or_older|sonoma_or_newer|monterey_or_older|monterey_or_newer|big_sur_or_older|big_sur_or_newer|catalina_or_older|catalina_or_newer|sequoia_or_older|sequoia_or_newer|tahoe_or_older|tahoe_or_newer)[a-z_]+/\n].freeze\ndef shim_compatible_formula?(src)\n  FORMULA_SHIM_UNSUPPORTED.none? { |re| src.match?(re) }\nend","tryCatchPattern":"# shell: on shim rejection, fall back to real Homebrew\nout=$(mise use \"brew:$FORMULA\" 2>&1)\nif [ $? -ne 0 ] && printf '%s' \"$out\" | grep -q 'source-build shim does not support'; then\n  brew install \"$FORMULA\"\nelse\n  printf '%s\\n' \"$out\"\nfi","preventionTips":["Prefer bottles/derived backends over source-building formulae: bottle pours skip the formula install DSL entirely","Keep Homebrew available as fallback for formulae with git/svn resources or rich patch sets, which the shim rejects by design","Update mise when source-build failures appear after homebrew/core formula updates — the DSL subset tracks upstream evolution","Read the exact feature name in the error (e.g. 'resource with download strategy :git') to decide between updating mise, pinning an older formula, or using brew"],"tags":["mise","homebrew","formula","ruby","shim","source-build","dsl"],"backgroundTag":"homebrew-formula-dsl-unsupported","analyzedSha":"6bd4a54fadcdf3a6757cc44061a9528b48dd2ae7","analyzedAt":"2026-08-16T19:20:32.527Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}