{"record":{"id":"79cddfeb15000008","repo":"Freika/dawarich","slug":"unsupported-export-format-version-version","errorCode":null,"errorMessage":"Unsupported export format version: %{version}","messagePattern":"Unsupported export format version: %(.+?)","errorType":"exception","errorClass":"StandardError","httpStatus":null,"severity":"error","filePath":"app/services/users/import_data.rb","lineNumber":208,"sourceCode":"      rescue JSON::ParserError\n        Rails.logger.warn 'Failed to parse manifest.json, falling back to v2'\n        2\n      end\n    elsif File.exist?(data_json_path)\n      1 # Legacy format\n    else\n      raise UnsupportedFormatError, I18n.t('services.users.import_data.unknown_export_format')\n    end\n  end\n\n  def create_handler(format_version)\n    case format_version\n    when 1\n      Users::ImportData::V1Handler.new(user, @import_directory, @import_stats)\n    when 2\n      Users::ImportData::V2Handler.new(user, @import_directory, @import_stats)\n    else\n      raise StandardError, I18n.t('services.users.import_data.unsupported_format_version', version: format_version)\n    end\n  end\n\n  def cleanup_temporary_files(import_directory)\n    return unless File.directory?(import_directory)\n\n    Rails.logger.info \"Cleaning up temporary import directory: #{import_directory}\"\n    FileUtils.rm_rf(import_directory)\n  rescue StandardError => e\n    ExceptionReporter.call(e, 'Failed to cleanup temporary files')\n  end\n\n  def create_success_notification\n    summary = \"#{@import_stats[:points_created]} points, \" \\\n      \"#{@import_stats[:visits_created]} visits, \" \\\n      \"#{@import_stats[:places_created]} places, \" \\\n      \"#{@import_stats[:trips_created]} trips, \" \\\n      \"#{@import_stats[:areas_created]} areas, \" \\","sourceCodeStart":190,"sourceCodeEnd":226,"githubUrl":"https://github.com/Freika/dawarich/blob/97fad417c5a11b0eb11157890635e015723a2e97/app/services/users/import_data.rb#L190-L226","documentation":"StandardError raised by create_handler when manifest.json's format_version is neither 1 nor 2. Version 1 is the legacy single data.json layout and 2 the JSONL-per-entity layout; any other value has no handler class. Subtlety: the comparison uses integer case values, so a JSON string \\\"2\\\" does not match `when 2` and lands here too. detect_format_version defaults to 2 only when format_version is absent (nil) or when manifest.json fails to parse.","triggerScenarios":"Importing an archive produced by a newer Dawarich that declares format_version 3, a manifest where format_version was serialized as a string, or a hand-edited manifest with a typo'd version.","commonSituations":"Version skew between the exporting and importing Dawarich instances (e.g. importing a new export into an older deployment), migrating data between servers running different releases.","solutions":["Open manifest.json and inspect the format_version value and its JSON type","If the exporting instance is newer, update the importing Dawarich to at least that version and re-import","If the archive really is the v2 JSONL layout, correct the manifest to the integer 2","Otherwise re-export from a source instance whose version matches what you are importing into"],"exampleFix":"# before: manifest written by another tool\n{ \"format_version\": \"2\", \"dawarich_version\": \"...\" }   # string fails `when 2`\n\n# after: integer version matching a real handler\n{ \"format_version\": 2, \"dawarich_version\": \"...\" }","handlingStrategy":"validation","validationCode":"manifest = JSON.parse(File.read(manifest_path))\nversion = manifest['format_version'].to_i  # coerce '2' -> 2\nraise ArgumentError, \"unsupported format_version #{manifest['format_version'].inspect}\" unless [1, 2].include?(version)","typeGuard":"def known_format_version?(manifest)\n  [1, 2].include?(manifest['format_version'].to_i)\nend","tryCatchPattern":"begin\n  Users::ImportData.new(user, archive).import\nrescue StandardError => e\n  if e.message.include?('Unsupported export format version')\n    # version skew: upgrade Dawarich or re-export from a matching version\n    notify_user('Archive was made by a different Dawarich version - update and retry')\n  else\n    raise\n  end\nend","preventionTips":["Keep exporting and importing instances on compatible versions; check manifest before importing","Treat format_version as an integer in tooling that writes manifests","Refuse imports of archives whose dawarich_version is newer than the current app"],"tags":["import","export","version-mismatch","manifest","user-data-restore"],"backgroundTag":"unsupported-format-version","analyzedSha":"97fad417c5a11b0eb11157890635e015723a2e97","analyzedAt":"2026-08-21T17:04:17.778Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}