{"record":{"id":"e312766942bfc42b","repo":"jdx/mise","slug":"formula-has-no-stable-sha256","errorCode":null,"errorMessage":"formula has no stable sha256","messagePattern":"formula has no stable sha256","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"src/system/packages/brew/tap_formula_metadata.rb","lineNumber":218,"sourceCode":"    def livecheck(*) = nil\n    def service(*) = nil\n    def test(*) = nil\n    def method_missing(*) = nil\n    def respond_to_missing?(*) = true\n  end\nend\n\ndef inferred_version(url)\n  basename = File.basename(url.to_s).sub(/\\.(tar\\.(gz|xz|bz2|zst)|tgz|txz|zip|gz)\\z/i, \"\")\n  match = basename.match(/(?:^|[-_v])([0-9]+(?:\\.[0-9A-Za-z]+)+(?:[-_.][0-9A-Za-z]+)*)/)\n  match && match[1]\nend\n\neval(STDIN.read.force_encoding(\"UTF-8\"), TOPLEVEL_BINDING, FORMULA_FILE, 1)\nklass = Formula.instance_variable_get(:@subclass)\nraise \"no Formula subclass found\" unless klass\nraise \"formula has no stable URL\" if klass.source_url.to_s.empty?\nraise \"formula has no stable sha256\" if klass.source_sha256.to_s.empty?\nversion = (klass.explicit_version || inferred_version(klass.source_url)).to_s\nraise \"could not infer formula version; add an explicit version declaration\" if version.to_s.empty?\n\nmetadata = {\n  \"name\" => FORMULA_NAME,\n  \"tap\" => ENV.fetch(\"MISE_BREW_TAP\"),\n  \"versions\" => { \"stable\" => version },\n  \"revision\" => klass.revision_value || 0,\n  \"keg_only\" => klass.keg_only_value || false,\n  \"dependencies\" => klass.runtime_dependencies || [],\n  \"build_dependencies\" => klass.build_dependencies || [],\n  \"bottle\" => {},\n  \"urls\" => { \"stable\" => { \"url\" => klass.source_url, \"checksum\" => klass.source_sha256 } },\n  \"ruby_source_path\" => ENV.fetch(\"MISE_BREW_SOURCE_PATH\"),\n  \"ruby_source_checksum\" => { \"sha256\" => ENV.fetch(\"MISE_BREW_SOURCE_CHECKSUM\") },\n  \"tap_git_head\" => ENV.fetch(\"MISE_BREW_TAP_COMMIT\")\n}\nputs JSON.generate(metadata)","sourceCodeStart":200,"sourceCodeEnd":236,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/system/packages/brew/tap_formula_metadata.rb#L200-L236","documentation":"mise's formula extractor requires the Formula subclass to record a stable sha256 checksum via the `sha256 \"...\"` DSL call; note the stub only stores the value when it is a String (`sha256(value) = ... if value.is_a?(String)`). If no sha256 was recorded — or it was given as `:no_check` or another non-String symbol — `klass.source_sha256` is empty and this raise fires. mise verifies source tarball integrity, so it refuses formulas without a stable checksum.","triggerScenarios":"Formula's stable block omits `sha256`; formula uses `sha256 :no_check` (a Symbol, silently dropped by the stub); sha256 declared only inside a conditional block that did not run (wrong MISE_BREW_OS/arch); sha256 specified via an unrecognized DSL form the stub discards.","commonSituations":"Live/head-only formulas that skip checksums; formulas migrated to `:no_check` for checksum-upstream breakage; checksum placed inside an `on_linux`/`on_macos` branch not matching the host platform; malformed formula from an out-of-date tap checkout.","solutions":["Ensure the formula's stable spec declares `sha256 \"<hex>\"` as a String","Replace `sha256 :no_check` with the real tarball checksum (compute with `shasum -a 256 <tarball>`)","If sha256 lives in a conditional block, verify MISE_BREW_OS/arch env so the block runs, or hoist the declaration to the stable block","Refresh the tap to a revision where the formula has a valid checksum"],"exampleFix":"// before\n//   stable do\n//     url \"https://example.com/foo-1.2.3.tar.gz\"\n//     sha256 :no_check\n//   end\n// after\n//   stable do\n//     url \"https://example.com/foo-1.2.3.tar.gz\"\n//     sha256 \"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855\"\n//   end","handlingStrategy":"validation","validationCode":"body = File.read(formula_path)\nraise \"formula lacks a String sha256\" unless body.match?(/^\\s*sha256\\s+[\"'][0-9a-fA-F]{64}[\"']/)","typeGuard":"def has_string_sha256?(formula_source)\n  !formula_source[/^\\s*sha256\\s+[\"']([0-9a-fA-F]{64})[\"']/, 1].to_s.empty?\nend","tryCatchPattern":"begin\n  extract_formula_metadata(formula_path)\nrescue RuntimeError => e\n  raise unless e.message == \"formula has no stable sha256\"\n  warn \"Formula sha256 missing or symbolic (:no_check); supply a real checksum\"\nend","preventionTips":["Verify each formula declares `sha256 \"<64-hex>\"` as a String, never `:no_check`","Compute checksums with `shasum -a 256` when authoring formulas","Refresh taps so checksum-bearing formula revisions are used","Keep platform env vars consistent so conditional sha256 blocks execute"],"tags":["homebrew","formula","checksum","sha256"],"backgroundTag":"checksum-mismatch","analyzedSha":"afd2eddd3a50c16190efc1c7e94404b48f72af57","analyzedAt":"2026-09-09T01:38:25.179Z","contentChangedAt":"2026-09-09T01:38:25.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}