jdx/mise · error · RuntimeError

unsupported cask metadata DSL `#{name}`

Error message

unsupported cask metadata DSL `#{name}`

What it means

The tap cask metadata shim implements only a small subset of the cask DSL, and its `method_missing` raises 'unsupported cask metadata DSL `<name>`' for any stanza it does not recognize. This is deliberate: unknown/ignored DSL could carry metadata the tool depends on, so instead of silently skipping, it fails loudly so the shim can be extended.

Source

Thrown at src/system/packages/brew/tap_cask_metadata.rb:271

      "token" => @token,
      "version" => @version.to_s,
      "auto_updates" => @auto_updates,
      "url" => @url,
      "sha256" => @sha256,
      "artifacts" => @artifacts,
      "depends_on" => {
        "formula" => @formula_dependencies,
        "cask" => @cask_dependencies
      },
      "conflicts_with" => { "cask" => @conflicting_casks },
      "ruby_source_path" => ENV.fetch("MISE_BREW_SOURCE_PATH"),
      "ruby_source_checksum" => { "sha256" => ENV.fetch("MISE_BREW_SOURCE_CHECKSUM") },
      "tap_git_head" => ENV.fetch("MISE_BREW_TAP_COMMIT")
    }
  end

  def method_missing(name, *, &block)
    raise "unsupported cask metadata DSL `#{name}`"
  end

  def respond_to_missing?(*) = true

  private

  def add_artifact(kind, source, target)
    value = [source.to_s]
    value << { "target" => target.to_s } unless target.nil?
    @artifacts << { kind => value }
  end
end

def cask(token, &block)
  $mise_cask_metadata = CaskMetadata.new(token)
  $mise_cask_metadata.instance_eval(&block)
end

View on GitHub (pinned to afd2eddd3a)

Solutions

  1. Identify the stanza name in the message and add a no-op or recording stub (e.g. `def livecheck(*) = nil`) to the shim's CaskMetadata class
  2. Use/upgrade to a mise version whose shim supports that cask stanza
  3. Patch the cask file (locally/vendored) to remove the unsupported stanza if it's not needed for metadata
  4. Skip the offending cask in the tap metadata generation and file an issue for shim support

Example fix

# before (shim)
def container(*) = nil
def deprecate!(**) = nil
# after (add stub for the unsupported stanza)
def container(*) = nil
def deprecate!(**) = nil
def livecheck(*) = nil
def depends_on(*) = nil
Defensive patterns

Strategy: try-catch

Validate before calling

known = %w[version url sha256 name desc homepage container deprecate! disable! no_autobump!]
unknown = File.read(cask_path).scan(/^\s*(\w+)[\s(!]/).flatten.uniq - known
raise "unsupported cask DSL: #{unknown.join(', ')}" unless unknown.empty?

Try / catch

begin
  metadata.instance_eval(cask_source)
rescue RuntimeError => e
  raise unless e.message.start_with?('unsupported cask metadata DSL')
  stanza = e.message[/`([^`]+)`/, 1]
  # add a stub or skip this cask
end

Prevention

When it happens

Trigger: A cask file evaluated via `instance_eval` calls any stanza not implemented by the shim — e.g. `app`, `binary`, `livecheck`, `depends_on`, `auto_updates` if not stubbed, nested blocks, or a newly introduced Homebrew DSL keyword.

Common situations: Upstream Homebrew added a new cask stanza the embedded shim hasn't learned yet; casks using common but unimplemented stanzas like `livecheck` or `depends_on macos`; evaluating a formula-like file through the cask metadata path by mistake.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of jdx/mise@afd2eddd3a (2026-09-09). Data as JSON: /api/errors/6abee0af0dcdf153. Report an issue: GitHub.