sequelize/sequelize · error · Error

`abstract` is not a valid option for @Table. Did you mean to

Error message

`abstract` is not a valid option for @Table. Did you mean to use @Table.Abstract?

What it means

Thrown by the @Table decorator factory when the options object contains an `abstract: true` flag. Sequelize separates concrete and abstract table decorators: @Table is for real models and @Table.Abstract is for base-only models. Passing abstract inside @Table is rejected because the two code paths differ (abstract models are not registered with a sequelize instance and cannot be queried).

Source

Thrown at packages/core/src/decorators/legacy/table.ts:33

 * class User extends Model<InferAttributes<User>, InferCreationAttributes<User>> {}
 * ```
 *
 * @param options
 */
export function Table<M extends Model = Model>(options: ModelOptions<M>): ClassDecorator;
export function Table(target: ModelStatic): void;
export function Table(arg: any): undefined | ClassDecorator {
  if (typeof arg === 'function') {
    annotate(arg);

    return undefined;
  }

  const options: ModelOptions = { ...arg };

  // @ts-expect-error -- making sure the option is not provided.
  if (options.abstract) {
    throw new Error(
      '`abstract` is not a valid option for @Table. Did you mean to use @Table.Abstract?',
    );
  }

  return (target: any) => annotate(target, options);
}

function AbstractTable<M extends Model = Model>(
  options: Omit<ModelOptions<M>, 'tableName' | 'name'>,
): ClassDecorator;
function AbstractTable(target: ModelStatic): void;
function AbstractTable(arg: any): undefined | ClassDecorator {
  if (typeof arg === 'function') {
    annotate(arg, { abstract: true });

    return undefined;
  }

View on GitHub (pinned to 7e1deec499)

Solutions

  1. Use `@Table.Abstract(options)` instead of `@Table({ abstract: true, ... })`.
  2. Remove the `abstract` key entirely if the model is meant to be concrete.
  3. If you need an abstract base class with no options, use the bare `@Table.Abstract` form.

Example fix

// before
@Table({ abstract: true })
abstract class Base extends Model {}

// after
@Table.Abstract()
abstract class Base extends Model {}
Defensive patterns

Strategy: validation

Validate before calling

// Validate @Table options do not include 'abstract'.
function assertTableOptions(options: Record<string, unknown>) {
  if ('abstract' in options && options.abstract) {
    throw new Error('Use @Table.Abstract instead of @Table({ abstract: true })');
  }
}
assertTableOptions(tableOpts);

Prevention

When it happens

Trigger: Calling `@Table({ abstract: true })` or `@Table({ abstract: true, tableName: 'foo' })` on a class. Any truthy value under the `abstract` key inside the options passed to the plain @Table decorator triggers it.

Common situations: Coming from another ORM (TypeORM) where `@Entity({ abstract: true })` is the documented pattern. Copying a @Table call and adding abstract:true without reading the v7 docs. Migrating from v6 define-based abstract models.

Related errors


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