jdx/mise · error · RuntimeError
formula declares a DATA patch but has no __END__ section
Error message
formula declares a DATA patch but has no __END__ section
What it means
The shim's Patch apply! supports DATA patches, which store the patch content after the formula file's __END__ marker. It raises when a patch was declared as DATA (@data = true) but the formula file contains no __END__ section, so there is no patch content to extract.
Source
Thrown at src/system/packages/brew/shim.rb:461
def url(url = nil, **)
@url = url unless url.nil?
@url
end
def sha256(sha = nil)
@sha256 = sha unless sha.nil?
@sha256
end
def data!
@data = true
end
def apply!
if @data
content = @formula_file.read.split(/^__END__$/, 2)[1]
raise "formula declares a DATA patch but has no __END__ section" if content.nil?
apply_content(content.sub(/\A\n/, ""))
elsif @url
file = MiseDownload.fetch(@url, @sha256, "patch")
apply_content(file.read)
end
end
private
def apply_content(content)
ohai "Applying patch (-p#{@strip})"
Open3.popen2e("patch", "-g", "0", "-f", "-p#{@strip}") do |stdin, out, thread|
stdin.write(content)
stdin.close
output = out.read
raise "patch failed:\n#{output}" unless thread.value.success?
$stdout.puts output
endView on GitHub (pinned to afd2eddd3a)
Solutions
- Append __END__ to the formula file followed by the patch content
- Move the patch to a url-based patch (`patch do url ... end`) if inline data isn't wanted
- Check the formula file wasn't truncated during copy/download
Example fix
# before def patch patch :data end # (file ends here) # after def patch patch :data end __END__ --- a/src/config.c +++ b/src/config.c @@ -1,3 +1,3 @@ -OLD +NEW
Defensive patterns
Strategy: validation
Validate before calling
raise "DATA patch without __END__" if patch_data && !formula_file.read.include?("__END__") Prevention
- Verify __END__ + patch body survive any formula copy/transform
- Prefer url patches for long diffs to avoid file-truncation issues
- Lint formulas that use patch :data for the __END__ marker
When it happens
Trigger: A formula declares `patch :data` but the file lacks `__END__` followed by the unified diff; formula was truncated when copied; patch DSL mismatch where content was expected inline after __END__.
Common situations: Hand-copied formulas missing the trailing patch text; editors or linters stripping content after __END__; formula ports from Homebrew where the DATA patch section was dropped.
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
- patch failed:\n#{output}
- undefined resource #{name.inspect}
- inreplace: missing before/after
- inreplace in #{path} made no substitutions — the formula may
- no precompiled ruby is available for this platform To compil
AI-assisted analysis of jdx/mise@afd2eddd3a (2026-09-09).
Data as JSON: /api/errors/eaa12c6b8385a1ad.
Report an issue: GitHub.