Freika/dawarich · error · ArgumentError

Unsupported source: %{source}

Error message

Unsupported source: %{source}

What it means

ArgumentError raised by Imports::Create#importer when the import's source value matches none of the supported importer names (google_semantic_history, google_phone_takeout, google_records, google_photos, owntracks, gpx, kml, geojson, immich_api, photoprism_api, csv, tcx, fit, polarsteps). The case statement maps source names to importer classes and deliberately raises for unknown values instead of guessing. Note 'zip' is special-cased to the separate zip_unclassified error at line 114.

Source

Thrown at app/services/imports/create.rb:116

    case source.to_s
    when 'google_semantic_history'      then GoogleMaps::SemanticHistoryImporter
    when 'google_phone_takeout'         then GoogleMaps::PhoneTakeoutImporter
    when 'google_records'               then GoogleMaps::RecordsStorageImporter
    when 'google_photos'                then GooglePhotos::Importer
    when 'owntracks'                    then OwnTracks::Importer
    when 'gpx'                          then Gpx::TrackImporter
    when 'kml'                          then Kml::Importer
    when 'geojson'                      then Geojson::Importer
    when 'immich_api', 'photoprism_api' then Photos::Importer
    when 'csv'                          then Csv::Importer
    when 'tcx'                          then Tcx::Importer
    when 'fit'                          then Fit::Importer
    when 'polarsteps'                   then Polarsteps::Importer
    when 'zip'
      raise ArgumentError, I18n.t('services.imports.create.zip_unclassified')
    else
      raise ArgumentError, I18n.t('services.imports.create.unsupported_source', source:)
    end
  end

  def update_import_points_count(import)
    Import::UpdatePointsCountJob.perform_later(import.id)
  end

  def notify_if_all_skipped(import)
    import.reload
    return unless import.points.count.zero?

    if import.doubles.to_i.positive?
      I18n.with_locale(import.user.locale) do
        Notification.create!(
          user_id: import.user_id,
          title: I18n.t('services.imports.create.import_completed_with_no_new_points'),
          content: I18n.t('services.imports.create.your_file_name_contained_raw_points_points_all_of_which',
                          name: import.name, raw_points: import.raw_points),

View on GitHub (pinned to 97fad417c5)

Solutions

  1. Inspect the value: Import.find(id).source, and compare against the case list in app/services/imports/create.rb:99-117
  2. Clear or correct the source column to a supported name so auto-detection re-runs
  3. Update Dawarich to a version that maps this source name
  4. Re-create the import without pinning source, letting SourceDetector pick it from file contents

Example fix

# before: import stuck failing with 'Unsupported source: google_timeline'
import.update!(source: 'google_timeline')

# after: clear source so run_importer re-detects from the file
import.update!(source: nil)
Imports::Create.new(user, import.reload).call
Defensive patterns

Strategy: validation

Validate before calling

SUPPORTED_SOURCES = %w[google_semantic_history google_phone_takeout google_records google_photos
                        owntracks gpx kml geojson immich_api photoprism_api csv tcx fit polarsteps].freeze

raise ArgumentError, "unsupported source #{source.inspect}" unless SUPPORTED_SOURCES.include?(source.to_s)

Type guard

def supported_source?(source)
  %w[google_semantic_history google_phone_takeout google_records google_photos owntracks gpx kml geojson
     immich_api photoprism_api csv tcx fit polarsteps].include?(source.to_s)
end

Try / catch

begin
  importer(source).new(import, user.id, path).call
rescue ArgumentError => e
  # surface to the user: which source value failed vs. the supported list
  notify_user("#{e.message} - supported: #{SUPPORTED_SOURCES.join(', ')}")
end

Prevention

When it happens

Trigger: An Import record whose source column holds a legacy or renamed value (e.g. an old 'google_timeline' string from an earlier Dawarich version), a source injected via console or API with a typo, or a detection result from a newer format this app version has no importer mapping for.

Common situations: Version skew after upgrading Dawarich (source names changed between releases), scripts or seeds creating Import rows with arbitrary source strings, or running an older app version against data produced by a newer one.

Related errors


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