redis/redis-rb · error · ArgumentError

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

Error message

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

What it means

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

Source

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

        # 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
        # @option options [String] :as an alias for the field
        # @option options [String] :separator the tag separator character
        # @option options [Boolean] :case_sensitive keep tag casing
        # @option options [Boolean] :index_empty index empty values
        # @option options [Boolean] :index_missing index documents missing the field
        # @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 tag_field(name, **options)
          valid_options = %i[sortable no_index as separator case_sensitive index_empty index_missing withsuffixtrie]
          invalid_options = options.keys - valid_options
          if invalid_options.any?
            raise ArgumentError, "Invalid options for tag field: #{invalid_options.join(', ')}"
          end

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

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

        # Add a {GeoShapeField} to the schema.
        #
        # @param [String, Symbol] name the document attribute the field indexes
        # @param [String, nil] coord_system the coordinate system, +FLAT+ or +SPHERICAL+;
        #   nil (the default) omits the token so the server default (+SPHERICAL+) applies

View on GitHub (pinned to 2ba9010b91)

Solutions

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

When it happens

Trigger: Thrown at lib/redis/commands/modules/search/schema.rb:126 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/d2fe061a1c52a2ca. Report an issue: GitHub.