Freika/dawarich · error · StandardError

Unsupported export format version: %{version}

Error message

Unsupported export format version: %{version}

What it means

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.

Source

Thrown at app/services/users/import_data.rb:208

      rescue JSON::ParserError
        Rails.logger.warn 'Failed to parse manifest.json, falling back to v2'
        2
      end
    elsif File.exist?(data_json_path)
      1 # Legacy format
    else
      raise UnsupportedFormatError, I18n.t('services.users.import_data.unknown_export_format')
    end
  end

  def create_handler(format_version)
    case format_version
    when 1
      Users::ImportData::V1Handler.new(user, @import_directory, @import_stats)
    when 2
      Users::ImportData::V2Handler.new(user, @import_directory, @import_stats)
    else
      raise StandardError, I18n.t('services.users.import_data.unsupported_format_version', version: format_version)
    end
  end

  def cleanup_temporary_files(import_directory)
    return unless File.directory?(import_directory)

    Rails.logger.info "Cleaning up temporary import directory: #{import_directory}"
    FileUtils.rm_rf(import_directory)
  rescue StandardError => e
    ExceptionReporter.call(e, 'Failed to cleanup temporary files')
  end

  def create_success_notification
    summary = "#{@import_stats[:points_created]} points, " \
      "#{@import_stats[:visits_created]} visits, " \
      "#{@import_stats[:places_created]} places, " \
      "#{@import_stats[:trips_created]} trips, " \
      "#{@import_stats[:areas_created]} areas, " \

View on GitHub (pinned to 97fad417c5)

Solutions

  1. Open manifest.json and inspect the format_version value and its JSON type
  2. If the exporting instance is newer, update the importing Dawarich to at least that version and re-import
  3. If the archive really is the v2 JSONL layout, correct the manifest to the integer 2
  4. Otherwise re-export from a source instance whose version matches what you are importing into

Example fix

# before: manifest written by another tool
{ "format_version": "2", "dawarich_version": "..." }   # string fails `when 2`

# after: integer version matching a real handler
{ "format_version": 2, "dawarich_version": "..." }
Defensive patterns

Strategy: validation

Validate before calling

manifest = JSON.parse(File.read(manifest_path))
version = manifest['format_version'].to_i  # coerce '2' -> 2
raise ArgumentError, "unsupported format_version #{manifest['format_version'].inspect}" unless [1, 2].include?(version)

Type guard

def known_format_version?(manifest)
  [1, 2].include?(manifest['format_version'].to_i)
end

Try / catch

begin
  Users::ImportData.new(user, archive).import
rescue StandardError => e
  if e.message.include?('Unsupported export format version')
    # version skew: upgrade Dawarich or re-export from a matching version
    notify_user('Archive was made by a different Dawarich version - update and retry')
  else
    raise
  end
end

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of Freika/dawarich@97fad417c5 (2026-08-21). Data as JSON: /api/errors/79cddfeb15000008. Report an issue: GitHub.