ankane/searchkick · error · ArgumentError

Invalid value for mode

Error message

Invalid value for mode

What it means

Error "Invalid value for mode" thrown in ankane/searchkick.

Source

Thrown at lib/searchkick/record_indexer.rb:66

          Searchkick::BulkReindexJob.set(**job_options).perform_later(
            class_name: records.first.class.searchkick_options[:class_name],
            record_ids: records.map { |r| r.id.to_s },
            index_name: index.name,
            method_name: method_name ? method_name.to_s : nil,
            **extra_options
          )
        end
      when :queue
        if method_name
          raise Error, "Partial reindex not supported with queue option"
        end

        index.reindex_queue.push_records(records)
      when true, :inline
        index_records, other_records = records.partition { |r| index_record?(r) }
        import_inline(index_records, !full ? other_records : [], method_name: method_name, ignore_missing: ignore_missing, single: single)
      else
        raise ArgumentError, "Invalid value for mode"
      end

      # return true like model and relation reindex for now
      true
    end

    def reindex_items(klass, items, method_name:, ignore_missing:, single: false)
      routing = items.to_h { |r| [r[:id], r[:routing]] }
      record_ids = routing.keys

      relation = Searchkick.load_records(klass, record_ids)
      # call search_import even for single records for nested associations
      relation = relation.search_import if relation.respond_to?(:search_import)
      records = relation.select(&:should_index?)

      # determine which records to delete
      delete_ids = record_ids - records.map { |r| r.id.to_s }
      delete_records =

View on GitHub (pinned to 93e901a75b)

When it happens

Trigger: Thrown at lib/searchkick/record_indexer.rb:66 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of ankane/searchkick@93e901a75b (2026-08-21). Data as JSON: /api/errors/7986ab0b127c1427. Report an issue: GitHub.