jdx/mise · error · RuntimeError
#{context}: missing sha256
Error message
#{context}: missing sha256 What it means
The Ruby brew shim's MiseDownload.fetch refuses to download when the caller passes an empty or blank sha256. Every fetched artifact must have a checksum so the cache is content-addressed and verified; a missing digest means mise cannot guarantee artifact integrity, so fetch raises immediately.
Source
Thrown at src/system/packages/brew/shim.rb:72
def odie(message)
$stderr.puts "Error: #{message}"
exit 1
end
class ShimUnsupportedError < StandardError; end
def shim_unsupported!(feature)
raise ShimUnsupportedError,
"formula uses `#{feature}`, which mise's source-build shim does not support"
end
module MiseDownload
module_function
# download with redirects into the cache, verify, return the path
def fetch(url, sha256, context)
raise "#{context}: missing sha256" if sha256.to_s.strip.empty?
sha256 = sha256.to_s.strip.downcase
raise "#{context}: malformed sha256" unless sha256.match?(/\A[0-9a-f]{64}\z/)
MISE_BREW_CACHE.mkpath
dest = MISE_BREW_CACHE + "#{sha256}--#{File.basename(URI(url).path)}"
unless dest.file? && Digest::SHA256.file(dest).hexdigest == sha256
ohai "Downloading #{url}"
tmp = Pathname.new("#{dest}.incomplete")
URI.open(url, "rb", redirect: true) do |remote|
tmp.open("wb") { |f| IO.copy_stream(remote, f) }
end
actual = Digest::SHA256.file(tmp).hexdigest
if actual != sha256
tmp.unlink
raise "#{context}: sha256 mismatch (expected #{sha256}, got #{actual})"
end
tmp.rename(dest)
endView on GitHub (pinned to afd2eddd3a)
Solutions
- Provide the correct 64-hex-character sha256 for the artifact in the recipe/invocation.
- Compute it locally: curl -L <url> | sha256sum, then put the digest into the package config.
- Regenerate the recipe with a template that includes the checksum field.
- If the artifact upstream doesn't publish a checksum, pin a version that does or vendor the file.
Example fix
// before MiseDownload.fetch(url, nil, "clang") // after MiseDownload.fetch(url, "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "clang")
Defensive patterns
Strategy: validation
Validate before calling
# ruby guard before calling fetch raise "sha256 required" if sha256.nil? || sha256.to_s.strip.empty? MiseDownload.fetch(url, sha256, context)
Try / catch
begin
MiseDownload.fetch(url, sha256, context)
rescue RuntimeError => e
raise unless e.message.include?("missing sha256")
# fall back or surface a config error
end Prevention
- Always include a sha256 in package recipes; treat it as mandatory.
- Generate recipes from templates that require the checksum field.
- Compute checksums from official release checksum files.
When it happens
Trigger: A brew shim package recipe calls cc/cxx-backed fetch with sha256 nil, '', or whitespace only — e.g. a recipe template that failed to substitute the checksum.
Common situations: Hand-written or generated package recipes missing the sha256 field; templating producing empty checksums; upstream metadata lacking the digest.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- #{context}: malformed sha256
- #{context}: sha256 mismatch (expected #{sha256}, got #{actua
- {name}: sha256 is {actual}, the packslip says {}
- brew-cask:{}: cask metadata has no sha256
- failed to decompress #{archive}
AI-assisted analysis of jdx/mise@afd2eddd3a (2026-09-09).
Data as JSON: /api/errors/0a3724183e25ced8.
Report an issue: GitHub.