redis/redis-rb · error · ArgumentError

Invalid options for text field: #{invalid_options.join(', ')

Error message

Invalid options for text field: #{invalid_options.join(', ')}

What it means

Error "Invalid options for text field: #{invalid_options.join(', ')}" thrown in redis/redis-rb.

Source

Thrown at lib/redis/commands/modules/search/schema.rb:95

        # Add a {TextField} to the schema.
        #
        # @param [String, Symbol] name the document attribute the field indexes
        # @option options [Numeric] :weight the field's scoring weight
        # @option options [Boolean] :sortable allow sorting by the field
        # @option options [Boolean] :no_index do not index the field
        # @option options [String] :as an alias for the field
        # @option options [String] :phonetic phonetic matcher
        # @option options [Boolean] :no_stem disable stemming
        # @option options [Boolean] :index_empty index empty values
        # @option options [Boolean] :withsuffixtrie build a suffix trie
        # @return [Array<Field>] the updated field list
        # @raise [ArgumentError] if an unknown option key is given
        def text_field(name, **options)
          valid_options = %i[weight sortable no_index as phonetic no_stem index_empty index_missing withsuffixtrie]
          invalid_options = options.keys - valid_options
          if invalid_options.any?
            raise ArgumentError, "Invalid options for text field: #{invalid_options.join(', ')}"
          end

          @fields << TextField.new(name, **options)
        end

        # Add a {NumericField} to the schema.
        #
        # @param [String, Symbol] name the document attribute the field indexes
        # @return [Array<Field>] the updated field list
        def numeric_field(name, **options)
          @fields << NumericField.new(name, **options)
        end

        # Add a {TagField} to the schema.
        #
        # @param [String, Symbol] name the document attribute the field indexes
        # @option options [Boolean] :sortable allow sorting by the field
        # @option options [Boolean] :no_index do not index the field

View on GitHub (pinned to 2ba9010b91)

Solutions

  1. Remove the listed invalid options from the text field definition; only the supported text-field options are allowed.
  2. Check the option names for typos against the text field documentation.

When it happens

Trigger: Thrown at lib/redis/commands/modules/search/schema.rb:95 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of redis/redis-rb@2ba9010b91 (2026-08-23). Data as JSON: /api/errors/5583d8dbee7a674d. Report an issue: GitHub.