n8n-io/n8n · error · TypeORMError

Supplied check constraint was not found in table ${table.nam

Error message

Supplied check constraint was not found in table ${table.name}

What it means

dropCheckConstraint() resolves the check constraint by name (or object) against the cached table; if none matches it throws TypeORMError. The check constraint you are trying to drop does not exist in the table definition TypeORM has loaded.

Source

Thrown at packages/@n8n/typeorm/src/driver/sqlite-abstract/AbstractSqliteQueryRunner.ts:857

		checkConstraints.forEach((checkConstraint) => changedTable.addCheckConstraint(checkConstraint));
		await this.recreateTable(changedTable, table);
	}

	/**
	 * Drops check constraint.
	 */
	async dropCheckConstraint(
		tableOrName: Table | string,
		checkOrName: TableCheck | string,
	): Promise<void> {
		const table = InstanceChecker.isTable(tableOrName)
			? tableOrName
			: await this.getCachedTable(tableOrName);
		const checkConstraint = InstanceChecker.isTableCheck(checkOrName)
			? checkOrName
			: table.checks.find((c) => c.name === checkOrName);
		if (!checkConstraint)
			throw new TypeORMError(`Supplied check constraint was not found in table ${table.name}`);

		await this.dropCheckConstraints(table, [checkConstraint]);
	}

	/**
	 * Drops check constraints.
	 */
	async dropCheckConstraints(
		tableOrName: Table | string,
		checkConstraints: TableCheck[],
	): Promise<void> {
		const table = InstanceChecker.isTable(tableOrName)
			? tableOrName
			: await this.getCachedTable(tableOrName);

		// clone original table and remove check constraints from cloned table
		const changedTable = table.clone();
		checkConstraints.forEach((checkConstraint) =>

View on GitHub (pinned to 5ac6606e81)

Solutions

  1. Resolve the actual check-constraint name from the live schema via getTable().checks before dropping.
  2. Make the drop idempotent — check existence first.
  3. Re-fetch the table via getTable() if metadata may be stale.

Example fix

// before
await queryRunner.dropCheckConstraint('user', 'CHK_user_age');

// after
const table = await queryRunner.getTable('user');
if (table?.checks.some((c) => c.name === 'CHK_user_age')) {
  await queryRunner.dropCheckConstraint(table!, 'CHK_user_age');
}
Defensive patterns

Strategy: validation

Validate before calling

const table = await queryRunner.getTable('user');
if (table?.checks.some((c) => c.name === 'CHK_user_age')) {
  await queryRunner.dropCheckConstraint(table!, 'CHK_user_age');
}

Type guard

const checkExists = async (qr: QueryRunner, tableName: string, name: string): Promise<boolean> =>
  Boolean((await qr.getTable(tableName))?.checks.some((c) => c.name === name));

Prevention

When it happens

Trigger: Calling dropCheckConstraint(table, 'constraintName') where 'constraintName' is not present in table.checks of the cached table.

Common situations: Re-running a migration that already dropped it, a typo in the constraint name (SQLite often auto-generates these), or stale cached metadata.

Related errors


AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12). Data as JSON: /api/errors/226900fc523b04cd. Report an issue: GitHub.