{"record":{"id":"2d3513bffea66067","repo":"Freika/dawarich","slug":"manifest-file-not-found-in-archive-manifest-json","errorCode":null,"errorMessage":"Manifest file not found in archive: manifest.json","messagePattern":"Manifest file not found in archive: manifest\\.json","errorType":"exception","errorClass":"StandardError","httpStatus":null,"severity":"error","filePath":"app/services/users/import_data/v2_handler.rb","lineNumber":83,"sourceCode":"    import_tracks_from_files\n    import_points_from_files\n    import_raw_data_archives\n\n    Rails.logger.info \"V2 data import completed. Stats: #{import_stats}\"\n  end\n\n  def expected_counts\n    @manifest&.dig('counts')\n  end\n\n  private\n\n  attr_reader :user, :import_directory, :import_stats\n\n  def load_manifest\n    manifest_path = import_directory.join('manifest.json')\n    unless File.exist?(manifest_path)\n      raise StandardError,\n            I18n.t('services.users.import_data.v2_handler.manifest_missing')\n    end\n\n    @manifest = JSON.parse(File.read(manifest_path))\n    Rails.logger.info \"Loaded manifest: format_version=#{@manifest['format_version']}, \" \\\n                      \"dawarich_version=#{@manifest['dawarich_version']}, \" \\\n                      \"exported_at=#{@manifest['exported_at']}\"\n  end\n\n  def import_settings\n    settings_path = import_directory.join('settings.jsonl')\n    return unless File.exist?(settings_path)\n\n    File.foreach(settings_path) do |line|\n      line = line.strip\n      next if line.blank?\n\n      settings_data = Oj.load(line)","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/Freika/dawarich/blob/97fad417c5a11b0eb11157890635e015723a2e97/app/services/users/import_data/v2_handler.rb#L65-L101","documentation":"StandardError raised by V2Handler#load_manifest when manifest.json is absent from the import directory. The v2 handler is normally selected precisely because detect_format_version saw manifest.json exist, so this raise means the file vanished after detection, its zip entry was skipped during extraction, or the handler ran against the wrong/partial directory. Note: a manifest.json that exists but is invalid JSON takes a different path (JSON::ParserError from load_manifest's parse) - this error is strictly file-absence.","triggerScenarios":"Direct console/test invocation of V2Handler with a directory lacking manifest.json; a zip whose manifest entry name was rejected by the traversal-safe sanitizer; the manifest removed between detect_format_version and handler.process (tmp race).","commonSituations":"Development runs against partial extractions, exports re-packed so manifest.json sits in a subfolder (which usually surfaces earlier as error 48), or tmp-cleanup races.","solutions":["Confirm manifest.json is a root entry of the archive (unzip -l)","Run the import through Users::ImportData#import rather than the handler directly so extraction + detection + processing share one directory","Re-pack the export so manifest.json is at the root","Guard concurrent tmp cleaners while the import runs"],"exampleFix":"# before\nUsers::ImportData::V2Handler.new(user, Pathname.new('tmp/partial'), stats).process\n\n# after\nresult = Users::ImportData.new(user, 'export.zip').import\nraise 'import aborted' if result.nil?  # nil => failure notification was created","handlingStrategy":"validation","validationCode":"manifest_path = import_directory.join('manifest.json')\nraise ArgumentError, 'manifest.json missing from extraction directory' unless File.exist?(manifest_path)","typeGuard":"def v2_importable?(import_directory)\n  File.file?(import_directory.join('manifest.json'))\nend","tryCatchPattern":"begin\n  Users::ImportData::V2Handler.new(user, dir, stats).process\nrescue StandardError => e\n  raise if e.message !~ /manifest/i\n  Rails.logger.error(\"v2 import missing manifest: #{e.message}\")\nend","preventionTips":["Always invoke via Users::ImportData#import so format detection and the handler see the same directory","Verify manifest.json placement with unzip -l before importing","Don't move/repack individual files out of an export archive"],"tags":["import","export","manifest","missing-file","v2-handler","user-data-restore"],"backgroundTag":"missing-manifest-file","analyzedSha":"97fad417c5a11b0eb11157890635e015723a2e97","analyzedAt":"2026-08-21T17:04:17.778Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}