puppetlabs/puppet · error · Puppet::Error

Need exactly two arguments: filebucket diff <file_a> <file_b

Error message

Need exactly two arguments: filebucket diff <file_a> <file_b>

What it means

Puppet::Application::Filebucket#diff raises Puppet::Error unless exactly two positional arguments follow 'filebucket diff'. Each argument may be either a path to an existing file or a checksum digest string; the count check runs before any resolution starts.

Source

Thrown at lib/puppet/application/filebucket.rb:260

      puts "#{file}: #{digest}"
    end
  end

  def list
    fromdate = options[:fromdate]
    todate = options[:todate]
    out = @client.list(fromdate, todate)
    print out
  end

  def restore
    file = args.shift
    digest = args.shift
    @client.restore(file, digest)
  end

  def diff
    raise Puppet::Error, _("Need exactly two arguments: filebucket diff <file_a> <file_b>") unless args.count == 2

    left = args.shift
    right = args.shift
    if Puppet::FileSystem.exist?(left)
      # It's a file
      file_a = left
      checksum_a = nil
    else
      file_a = nil
      checksum_a = left
    end
    if Puppet::FileSystem.exist?(right)
      # It's a file
      file_b = right
      checksum_b = nil
    else
      file_b = nil
      checksum_b = right

View on GitHub (pinned to e227c27540)

Solutions

  1. Pass exactly two arguments, each an existing file path or a digest: puppet filebucket diff FILE_A FILE_B
  2. Quote path arguments containing spaces so the command stays two words
  3. To compare a file with its bucketed version, pass the live file path and its md5/sha256 digest

Example fix

# before
puppet filebucket diff /etc/passwd

# after
puppet filebucket diff /etc/passwd "{sha256}<digest>"  # or a second file path
Defensive patterns

Strategy: validation

Validate before calling

raise ArgumentError, 'need exactly: filebucket diff FILE_A FILE_B' unless args.count == 2
system('puppet', 'filebucket', 'diff', *args)

Prevention

When it happens

Trigger: 'puppet filebucket diff <only-one>', three or more arguments, or none; programmatic invocation of the diff action with an args array whose count is not 2.

Common situations: Shell variables expanding to zero or multiple words; forgetting one side of the comparison; unquoted paths with spaces splitting into extra words.

Related errors


AI-assisted analysis of puppetlabs/puppet@e227c27540 (2026-08-21). Data as JSON: /api/errors/c3d79b382b257ea7. Report an issue: GitHub.