sequelize/sequelize · error · Error

The include attribute for indexes is not supported by ${this

Error message

The include attribute for indexes is not supported by ${this.dialect.name} dialect

What it means

Error "The include attribute for indexes is not supported by ${this.dialect.name} dialect" thrown in sequelize/sequelize.

Source

Thrown at packages/core/src/abstract-dialect/query-generator.js:739

          result += ` ${operator}`;
        }
      }

      if (this.dialect.supports.index.length > 0 && field.length > 0) {
        result += `(${field.length})`;
      }

      if (field.order) {
        result += ` ${field.order}`;
      }

      return result;
    });

    let includeSql;
    if (options.include) {
      if (!this.dialect.supports.index.include) {
        throw new Error(
          `The include attribute for indexes is not supported by ${this.dialect.name} dialect`,
        );
      }

      if (options.include instanceof Literal) {
        includeSql = `INCLUDE ${options.include.val}`;
      } else if (Array.isArray(options.include)) {
        includeSql = `INCLUDE (${options.include.map(field => (field instanceof Literal ? field.val : this.quoteIdentifier(field))).join(', ')})`;
      } else {
        throw new TypeError('The include attribute for indexes must be an array or a literal.');
      }
    }

    if (!options.name) {
      // Mostly for cases where addIndex is called directly by the user without an options object (for example in migrations)
      // All calls that go through sequelize should already have a name
      options = nameIndex(options, options.prefix);
    }

View on GitHub (pinned to 7e1deec499)

Solutions

  1. Remove the include attribute from the index definition; covering indexes with INCLUDE are only supported by some dialects (Postgres, MSSQL).

Example fix

{ indexes: [{ fields: ['a', 'b'] }] } // no include

When it happens

Trigger: Defining an index with the include option on a dialect that does not support covering indexes.

Common situations: Sharing model definitions across dialects.


AI-assisted analysis of sequelize/sequelize@7e1deec499 (2026-08-03). Data as JSON: /data/errors/c61d37cfbd10d989.json. Report an issue: GitHub.