n8n-io/n8n · error · TypeORMError
Sqlite does not support exclusion constraints.
Error message
Sqlite does not support exclusion constraints.
What it means
SQLite does not support exclusion constraints (a PostgreSQL feature). AbstractSqliteQueryRunner.createExclusionConstraint() unconditionally throws TypeORMError on call. There is no way to make this work on SQLite.
Source
Thrown at packages/@n8n/typeorm/src/driver/sqlite-abstract/AbstractSqliteQueryRunner.ts:889
: await this.getCachedTable(tableOrName);
// clone original table and remove check constraints from cloned table
const changedTable = table.clone();
checkConstraints.forEach((checkConstraint) =>
changedTable.removeCheckConstraint(checkConstraint),
);
await this.recreateTable(changedTable, table);
}
/**
* Creates a new exclusion constraint.
*/
async createExclusionConstraint(
tableOrName: Table | string,
exclusionConstraint: TableExclusion,
): Promise<void> {
throw new TypeORMError(`Sqlite does not support exclusion constraints.`);
}
/**
* Creates a new exclusion constraints.
*/
async createExclusionConstraints(
tableOrName: Table | string,
exclusionConstraints: TableExclusion[],
): Promise<void> {
throw new TypeORMError(`Sqlite does not support exclusion constraints.`);
}
/**
* Drops exclusion constraint.
*/
async dropExclusionConstraint(
tableOrName: Table | string,
exclusionOrName: TableExclusion | string,View on GitHub (pinned to 5ac6606e81)
Solutions
- Remove exclusion constraints from any entity/migration used with SQLite.
- Branch schema setup on driver type — only define exclusion constraints for Postgres.
- Use a Postgres backing store if the exclusion constraint is a hard requirement.
Example fix
// before
await queryRunner.createExclusionConstraint(table, exclConstraint);
// after
if (dataSource.options.type !== 'sqlite' && dataSource.options.type !== 'sqlite-pooled') {
await queryRunner.createExclusionConstraint(table, exclConstraint);
} Defensive patterns
Strategy: type-guard
Validate before calling
function supportsExclusionConstraints(ds: DataSource): boolean {
return ds.options.type === 'postgres';
}
if (supportsExclusionConstraints(dataSource)) {
await queryRunner.createExclusionConstraint(table, excl);
} Type guard
const driverSupportsExclusion = (ds: DataSource): boolean => ds.options.type === 'postgres';
Prevention
- Never declare exclusion constraints on entities shared with SQLite.
- Branch schema setup on driver type.
- Keep PG-only features behind a driver check.
When it happens
Trigger: Calling queryRunner.createExclusionConstraint(...) on a SQLite DataSource, or an entity/migration declaring an exclusion constraint that TypeORM attempts to apply.
Common situations: Sharing entity definitions between a Postgres and a SQLite DataSource where the entity declares an exclusion constraint; test fixtures using SQLite for a PG-only schema.
Related errors
- Supplied unique constraint was not found in table ${table.na
- Supplied check constraint was not found in table ${table.nam
- Supplied foreign key was not found in table ${table.name}
- SQLite package has not been found installed. Try to install
- Transactions aren't supported by ${this.connection.driver.op
AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12).
Data as JSON: /api/errors/12de4e58e60a11e7.
Report an issue: GitHub.