puppetlabs/puppet · error · Puppet::Error
Please provide a file or checksum to diff with
Error message
Please provide a file or checksum to diff with
What it means
Dipper#diff(checksum_a, checksum_b, file_a, file_b) compares two sides. When the first side is a bucket checksum (checksum_a given), the second side must be either checksum_b (another bucket sum) or file_b (a filesystem path). With neither supplied, Puppet::Error asks for a file or checksum to diff with.
Source
Thrown at lib/puppet/file_bucket/dipper.rb:85
if checksum_a
source_path = "#{@rest_path}#{@checksum_type}/#{checksum_a}"
if checksum_b
file_diff = Puppet::FileBucket::File.indirection.find(
source_path,
:bucket_path => @local_path,
:diff_with => checksum_b
)
elsif file_b
tmp_file = ::Tempfile.new('diff')
begin
restore(tmp_file.path, checksum_a)
file_diff = Puppet::Util::Diff.diff(tmp_file.path, file_b)
ensure
tmp_file.close
tmp_file.unlink
end
else
raise Puppet::Error, _("Please provide a file or checksum to diff with")
end
elsif file_a
if checksum_b
tmp_file = ::Tempfile.new('diff')
begin
restore(tmp_file.path, checksum_b)
file_diff = Puppet::Util::Diff.diff(file_a, tmp_file.path)
ensure
tmp_file.close
tmp_file.unlink
end
elsif file_b
file_diff = Puppet::Util::Diff.diff(file_a, file_b)
end
end
raise Puppet::Error, _("Failed to diff files") unless file_diff
file_diff.to_sView on GitHub (pinned to e227c27540)
Solutions
- Supply a second checksum: `puppet filebucket diff <sum_a> <sum_b>` (Dipper#diff(a, b))
- Or compare against a working file path as the fourth argument: Dipper#diff(sum_a, nil, nil, '/tmp/current')
- Guard the call site: only invoke diff when checksum_b or file_b is non-nil
Example fix
# before dipper.diff(sum_a, nil, nil, nil) # after dipper.diff(sum_a, nil, nil, '/etc/puppetlabs/puppet/puppet.conf')
Defensive patterns
Strategy: validation
Validate before calling
def diffable?(checksum_b, file_b) !checksum_b.nil? || !file_b.nil? || File.exist?(file_b.to_s) end raise ArgumentError, 'second side required: checksum_b or file_b' unless diffable?(checksum_b, file_b)
Prevention
- Treat Dipper#diff as requiring two non-nil sides; validate before the call
- When comparing against an optional working file, fall back to a checksum of that file instead of nil
When it happens
Trigger: Calling dipper.diff(sum_a, nil, nil, nil); CLI misuse such as `puppet filebucket diff <sum>` with no second operand; wrapper code that builds argument lists dynamically and leaves the right-hand side blank when the second input was not provided.
Common situations: Scripts that compare a backed-up file against a current file only when the current file exists, passing nil otherwise.
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
- Failed to diff files
- Diff is not supported on this platform
- Need exactly two arguments: filebucket diff <file_a> <file_b
- Could not back up %{file}: %{detail}
- File not found
AI-assisted analysis of puppetlabs/puppet@e227c27540 (2026-08-21).
Data as JSON: /api/errors/2380d419f913d2af.
Report an issue: GitHub.