jdx/mise · error · RuntimeError

cask has no URL

Error message

cask has no URL

What it means

Raised by CaskMetadata#to_h when the parsed cask has a version but the url stanza is missing or empty. mise needs the download URL to build its brew-source install plan, so metadata serialization is aborted when the cask provides no URL. This fires after the version check, meaning the cask parsed far enough to have a version but never set @url.

Solutions

  1. Ensure the cask declares a concrete https url stanza
  2. Extend the shim to handle the URL construct the cask uses (conditional or DSL variant)
  3. Update mise for newer cask DSL support
  4. Pin the cask to a revision with a plain url stanza

Example fix

# before (cask)
cask "foo" do
  version "1.2.3"
end
# after (cask)
cask "foo" do
  version "1.2.3"
  url "https://example.com/foo-1.2.3.dmg"
  sha256 "abc123..."
end
Defensive patterns

Strategy: validation

Validate before calling

raise "cask has no url stanza" unless cask_source.match?(/^\s*url\s+["']/)

Type guard

def has_url?(metadata) = !metadata.url.to_s.empty?

Try / catch

begin
  metadata = parse_cask_metadata(cask_source)
rescue RuntimeError => e
  raise unless e.message == "cask has no URL"
  warn "cask #{token} lacks a URL; skipping"
end

Prevention

When it happens

Trigger: Cask defines no url stanza (version-only or livecheck-style cask); url is set inside a conditional stanza (on_macos/on_arch) that did not run; a DSL variant for url that the shim does not recognize, so it fell through to an ignored path.

Common situations: `url :homebrew_cask` placeholder URLs; platform-conditional URLs where the host condition in the shim differs from the cask's expectation; newer cask URL DSL options unsupported by the shim.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/18b35923ff04d1f5. Report an issue: GitHub.

Appendix: source

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

    when :or_newer then host >= target
    else host.same_release?(target)
    end
  end
  private :macos_condition_matches?

  def name(*) = nil
  def desc(*) = nil
  def homepage(*) = nil
  def livecheck(*) = nil
  def caveats(*) = nil
  def container(*) = nil
  def deprecate!(**) = nil
  def disable!(**) = nil
  def no_autobump!(*) = nil

  def to_h
    raise "cask has no version" if @version.nil?
    raise "cask has no URL" if @url.to_s.empty?
    {
      "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

View on GitHub (pinned to 533346cc37)