{"record":{"id":"bb40b9b2c82b134d","repo":"puppetlabs/puppet","slug":"file-not-found","errorCode":null,"errorMessage":"File not found","messagePattern":"File not found","errorType":"exception","errorClass":"Puppet::Error","httpStatus":null,"severity":"error","filePath":"lib/puppet/file_bucket/dipper.rb","lineNumber":116,"sourceCode":"        file_diff = Puppet::Util::Diff.diff(file_a, file_b)\n      end\n    end\n    raise Puppet::Error, _(\"Failed to diff files\") unless file_diff\n\n    file_diff.to_s\n  end\n\n  # Retrieves a file by sum.\n  def getfile(sum)\n    get_bucket_file(sum).to_s\n  end\n\n  # Retrieves a FileBucket::File by sum.\n  def get_bucket_file(sum)\n    source_path = \"#{@rest_path}#{@checksum_type}/#{sum}\"\n    file_bucket_file = Puppet::FileBucket::File.indirection.find(source_path, :bucket_path => @local_path)\n\n    raise Puppet::Error, _(\"File not found\") unless file_bucket_file\n\n    file_bucket_file\n  end\n\n  # Restores the file\n  def restore(file, sum)\n    restore = true\n    file_handle = Puppet::FileSystem.pathname(file)\n    if Puppet::FileSystem.exist?(file_handle)\n      cursum = Puppet::FileBucket::File.new(file_handle).checksum_data()\n\n      # if the checksum has changed...\n      # this might be extra effort\n      if cursum == sum\n        restore = false\n      end\n    end\n","sourceCodeStart":98,"sourceCodeEnd":134,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/file_bucket/dipper.rb#L98-L134","documentation":"Dipper#get_bucket_file looks up a content blob by checksum via the FileBucket indirection (local bucketdir or remote server). When the find returns nil, the checksum is unknown to that bucket and Puppet::Error 'File not found' is raised. getfile and restore both funnel through this method, so every retrieval of an unknown sum fails here.","triggerScenarios":"`puppet filebucket get <sum>` for content never backed up into that bucket; restore() of a sum after the bucket directory was wiped; querying a server-side bucket for content stored only locally; digest algorithm changed (md5 vs sha256) so sums do not match.","commonSituations":"Disaster-recovery attempts after bucket cleanup; mixed local/server bucket configurations; sums copied by hand with typos; Puppet upgrades that changed digest_algorithm.","solutions":["Confirm the content exists where you are looking: `puppet filebucket find <sum>` (with the same --local/server settings), or list the local bucket","Re-populate the bucket: `puppet filebucket backup <file>`, then retry","Verify the settings match the ones used at backup time (bucketdir / server) and that digest_algorithm is unchanged"],"exampleFix":"# before\npuppet filebucket get 3c0b7f2d1a8e...  # File not found\n# after: re-backup from the surviving copy, then retrieve\npuppet filebucket backup /backup/puppet.conf\npuppet filebucket get 3c0b7f2d1a8e...","handlingStrategy":"try-catch","validationCode":"sum = sum.to_s.downcase\nraise ArgumentError, 'not an md5/sha256 hex sum' unless sum.match?(/\\A[0-9a-f]{32,64}\\z/)","typeGuard":null,"tryCatchPattern":"begin\n  content = dipper.getfile(sum)\nrescue Puppet::Error => e\n  raise unless e.message == 'File not found'\n  nil # caller decides: restore from another source, or re-backup\nend","preventionTips":["Confirm presence with `puppet filebucket find <sum>` before scripting a get/restore","Keep the bucket settings (bucketdir/server, digest_algorithm) stable between backup and restore"],"tags":["puppet","filebucket","checksum","file-not-found"],"backgroundTag":"file-not-found","analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}