{"record":{"id":"c57c130c32a8b6c0","repo":"jdx/mise","slug":"formula-has-no-stable-url","errorCode":null,"errorMessage":"formula has no stable URL","messagePattern":"formula has no stable URL","errorType":"validation","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"src/system/packages/brew/tap_formula_metadata.rb","lineNumber":237,"sourceCode":"\n# Match the formulae.brew.sh JSON: symbol reasons serialize as \":name\",\n# string reasons as-is.\ndef keg_only_reason_metadata(klass)\n  reason = klass.keg_only_reason_value\n  return nil if reason.nil?\n  { \"reason\" => reason.is_a?(Symbol) ? reason.inspect : reason.to_s }\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  \"keg_only_reason\" => keg_only_reason_metadata(klass),\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\")","sourceCodeStart":219,"sourceCodeEnd":255,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/packages/brew/tap_formula_metadata.rb#L219-L255","documentation":"Raised by mise's tap_formula_metadata.rb after a Formula subclass was found but its stable source_url is empty. mise builds third-party formulae from source and requires the formula's stable (non-legacy) url to know where to download the source; a formula without one cannot be processed. This is the first of three completeness checks on the class after the subclass guard.","triggerScenarios":"Formula defines no url stanza; url is only set in a deprecated/bottle or nested block; the stable spec is empty because the formula uses only devel/head specs; url is assigned via metaprogramming the shim does not execute.","commonSituations":"Head-only or bottle-only formulae; formulae defining url inside on_macos/on_linux conditional blocks; third-party formulae missing required stanzas.","solutions":["Add a stable `url` stanza to the formula","Extend the shim to resolve the URL construct the formula uses (e.g. conditional on_macos/on_linux urls)","Pin the formula to a revision with a stable url","Choose a different formula/package that provides a stable source URL"],"exampleFix":"# before (formula)\nclass Foo < Formula\n  desc \"Foo\"\n  version \"1.0\"\nend\n# after\nclass Foo < Formula\n  desc \"Foo\"\n  version \"1.0\"\n  url \"https://example.com/foo-1.0.tar.gz\"\n  sha256 \"abc...\"\nend","handlingStrategy":"validation","validationCode":"raise \"formula has no url\" unless formula_source.match?(/^\\s*url\\s+[\"']https?:/)","typeGuard":"def has_stable_url?(klass) = !klass.source_url.to_s.empty?","tryCatchPattern":"begin\n  metadata = parse_formula_metadata(formula_source)\nrescue RuntimeError => e\n  raise unless e.message == \"formula has no stable URL\"\n  warn \"formula lacks a stable url; cannot build from source\"\nend","preventionTips":["Require a stable top-level `url` stanza in third-party formulae","Avoid head-only or bottle-only formulae for source builds","Resolve conditional on_macos/on_linux urls against the target platform before extraction"],"tags":["ruby","formula","metadata","missing-field"],"backgroundTag":"empty-required-field","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}