{"record":{"id":"4fe068c1bae2bdb7","repo":"jdx/mise","slug":"cask-uses-feature-which-mise-s-cask-shim-doe","errorCode":null,"errorMessage":"cask uses `#{feature}`, which mise's cask shim does not support","messagePattern":"cask uses `#(.+?)`, which mise's cask shim does not support","errorType":"exception","errorClass":"ShimUnsupportedError","httpStatus":null,"severity":"error","filePath":"src/system/packages/brew/cask_shim.rb","lineNumber":51,"sourceCode":"end\n\nMISE_BREW_CASK_FILE = Pathname.new(ENV.fetch(\"MISE_BREW_CASK_FILE\"))\nMISE_BREW_CASK_TOKEN = ENV.fetch(\"MISE_BREW_CASK_TOKEN\")\nMISE_BREW_CASK_VERSION = ENV.fetch(\"MISE_BREW_CASK_VERSION\")\nMISE_BREW_CASK_STAGED_PATH = Pathname.new(ENV.fetch(\"MISE_BREW_CASK_STAGED_PATH\"))\nMISE_BREW_CASK_APPDIR = Pathname.new(ENV.fetch(\"MISE_BREW_CASK_APPDIR\"))\nMISE_BREW_PREFIX = Pathname.new(ENV.fetch(\"MISE_BREW_PREFIX\"))\nMISE_BREW_CASK_HOOK = ENV.fetch(\"MISE_BREW_CASK_HOOK\")\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        \"cask uses `#{feature}`, which mise's cask shim does not support\"\nend\n\nmodule OS\n  def self.mac?\n    RbConfig::CONFIG[\"host_os\"].include?(\"darwin\")\n  end\n\n  def self.linux?\n    RbConfig::CONFIG[\"host_os\"].include?(\"linux\")\n  end\nend\n\nclass MacOSVersion\n  include Comparable\n\n  SYMBOLS = {\n    tahoe: \"26\", sequoia: \"15\", sonoma: \"14\", ventura: \"13\",","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/jdx/mise/blob/6bd4a54fadcdf3a6757cc44061a9528b48dd2ae7/src/system/packages/brew/cask_shim.rb#L33-L69","documentation":"mise can install Homebrew casks without Homebrew by evaluating the cask's .rb DSL in its own Ruby shim (cask_shim.rb). The shim deliberately implements only a small surface of the Cask DSL and 'fails loudly instead of falling back to brew' (file header). When a cask's lifecycle code (preflight/postflight hooks) touches something outside that surface, `shim_unsupported!` raises ShimUnsupportedError and the top-level rescue converts it to `odie` — printing `Error: cask uses \\`X\\`, which mise's cask shim does not support` to stderr and exiting 1. Concrete raisers in the file: `method_missing` on the cask context (any unknown stanza, e.g. `installer`, `depends_on_macos`-style syntax not in the no-op list at cask_shim.rb:274-295), `on_system_conditional` without a branch for the current OS (line 271), `system_command` with unsupported keyword args (line 324), and `on_<macos_version>` with an unknown comparator (line 392).","triggerScenarios":"Installing or upgrading a brew cask through mise's system-packages integration (e.g. `mise use brew:cask/<token>` / `mise x brew:cask/<token>`) where the cask's preflight/postflight hook calls an unimplemented stanza, an `on_system_conditional` that only defines `macos:` while you run Linux (or vice versa), or `system_command` with extra kwargs. The error surfaces at hook-evaluation time, after the cask file is fetched and sha-verified but around artifact staging/linking.","commonSituations":"A cask you installed fine last month breaks after Homebrew updates it to use a newly-added DSL stanza (new macOS release symbols like `on_tahoe` variants, new `installer` forms); running a macos-only cask on Linux; exotic casks with `pkg` installers, license scripts, or `depends_on` blocks that need real brew behavior; mise's shim lagging behind Homebrew DSL evolution.","solutions":["Update mise to the latest release — the shim's supported DSL surface grows over time, and the failing stanza may have been added","Install that cask with real Homebrew instead: `brew install --cask <token>` (mise's shim intentionally does not fall back, so do it explicitly)","Pin the cask to an older version whose hooks only use supported stanzas (e.g. `mise use brew:cask/<token>@<older-version>`) if one is known to work","Check the cask source (brew info --cask <token> or github.com/Homebrew/homebrew-cask) to confirm which stanza triggered it, and file an issue at github.com/jdx/mise with the cask token so the DSL can be added"],"exampleFix":"# before (shim fails on unsupported cask stanza)\nmise use brew:cask/some-app\n# after (use real Homebrew for this cask)\nbrew install --cask some-app","handlingStrategy":"fallback","validationCode":"# probe the cask's hook surface before letting mise install it\n# (cask .rb files are plain ruby; check for stanzas outside the shim's no-op list)\nruby -e '\n  src = File.read(ARGV[0])\n  known = %w[sha256 url name desc homepage livecheck auto_updates conflicts_with depends_on caveats\n             app binary pkg font manpage bash_completion zsh_completion fish_completion uninstall zap\n             preflight postflight uninstall_preflight uninstall_postflight version arch language\n             on_catalina on_big_sur on_monterey on_ventura on_sonoma on_sequoia on_tahoe\n             on_intel on_arm on_macos on_linux system_command]\n  src.scan(/^\\s{2}(\\w+)/).flatten.uniq.each { |m| abort \"unsupported stanza: #{m}\" unless known.include?(m) }\n' \"$(brew --repository 2>/dev/null)/Caskroom/$(... )\" 2>/dev/null || echo \"skip probe: check cask manually\"","typeGuard":"# ruby: narrow to the stanzas the cask shim actually implements before running hooks\nCASK_SHIM_STANZAS = %w[sha256 url name desc homepage livecheck auto_updates conflicts_with\n  depends_on caveats app binary pkg font manpage bash_completion zsh_completion\n  fish_completion uninstall zap preflight postflight uninstall_preflight\n  uninstall_postflight version arch language staged_path appdir caskroom_path\n  system_command on_catalina on_big_sur on_monterey on_ventura on_sonoma\n  on_sequoia on_tahoe on_intel on_arm on_macos on_linux].freeze\ndef shim_compatible_cask?(cask_src)\n  calls = cask_src.scan(/^\\s{2}(\\w+)/).flatten.uniq\n  (calls - CASK_SHIM_STANZAS).empty?\nend","tryCatchPattern":"# shell: detect the shim error and fall back to real Homebrew for this cask\nout=$(mise use \"brew:cask:$TOKEN\" 2>&1)\nif [ $? -ne 0 ] && printf '%s' \"$out\" | grep -q 'cask shim does not support'; then\n  brew install --cask \"$TOKEN\"\nelse\n  printf '%s\\n' \"$out\"\nfi","preventionTips":["Keep Homebrew installed alongside mise as the fallback path for casks with complex hooks (pkg installers, scripts)","Update mise promptly when Homebrew adds new cask DSL — shim gaps are usually closed within releases","Before adopting a cask in team configs, install it once on each OS the team uses (a macos-only conditional breaks on Linux)"],"tags":["mise","homebrew","cask","ruby","shim","dsl","macos"],"backgroundTag":"homebrew-cask-dsl-unsupported","analyzedSha":"6bd4a54fadcdf3a6757cc44061a9528b48dd2ae7","analyzedAt":"2026-08-16T19:20:32.527Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}