{"record":{"id":"c3d79b382b257ea7","repo":"puppetlabs/puppet","slug":"need-exactly-two-arguments-filebucket-diff-file","errorCode":null,"errorMessage":"Need exactly two arguments: filebucket diff <file_a> <file_b>","messagePattern":"Need exactly two arguments: filebucket diff <file_a> <file_b>","errorType":"validation","errorClass":"Puppet::Error","httpStatus":null,"severity":"error","filePath":"lib/puppet/application/filebucket.rb","lineNumber":260,"sourceCode":"      puts \"#{file}: #{digest}\"\n    end\n  end\n\n  def list\n    fromdate = options[:fromdate]\n    todate = options[:todate]\n    out = @client.list(fromdate, todate)\n    print out\n  end\n\n  def restore\n    file = args.shift\n    digest = args.shift\n    @client.restore(file, digest)\n  end\n\n  def diff\n    raise Puppet::Error, _(\"Need exactly two arguments: filebucket diff <file_a> <file_b>\") unless args.count == 2\n\n    left = args.shift\n    right = args.shift\n    if Puppet::FileSystem.exist?(left)\n      # It's a file\n      file_a = left\n      checksum_a = nil\n    else\n      file_a = nil\n      checksum_a = left\n    end\n    if Puppet::FileSystem.exist?(right)\n      # It's a file\n      file_b = right\n      checksum_b = nil\n    else\n      file_b = nil\n      checksum_b = right","sourceCodeStart":242,"sourceCodeEnd":278,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/application/filebucket.rb#L242-L278","documentation":"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.","triggerScenarios":"'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.","commonSituations":"Shell variables expanding to zero or multiple words; forgetting one side of the comparison; unquoted paths with spaces splitting into extra words.","solutions":["Pass exactly two arguments, each an existing file path or a digest: puppet filebucket diff FILE_A FILE_B","Quote path arguments containing spaces so the command stays two words","To compare a file with its bucketed version, pass the live file path and its md5/sha256 digest"],"exampleFix":"# before\npuppet filebucket diff /etc/passwd\n\n# after\npuppet filebucket diff /etc/passwd \"{sha256}<digest>\"  # or a second file path","handlingStrategy":"validation","validationCode":"raise ArgumentError, 'need exactly: filebucket diff FILE_A FILE_B' unless args.count == 2\nsystem('puppet', 'filebucket', 'diff', *args)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Build the diff command from a fixed two-element array; reject anything else","Quote paths containing spaces","Accept either an existing file path or a digest string for each side"],"tags":["cli","filebucket","arguments","puppet"],"backgroundTag":"wrong-argument-count","analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}