n8n-io/n8n · error · TypeORMError
Column "${oldTableColumnOrName}" was not found in the "${tab
Error message
Column "${oldTableColumnOrName}" was not found in the "${table.name}" table. What it means
renameColumn() resolves the old column by name against the table's cached metadata; if no column matches it throws TypeORMError. This is a precondition failure — the column you are renaming does not exist in the table definition TypeORM has loaded.
Source
Thrown at packages/@n8n/typeorm/src/driver/sqlite-abstract/AbstractSqliteQueryRunner.ts:528
await this.recreateTable(changedTable, table);
}
/**
* Renames column in the given table.
*/
async renameColumn(
tableOrName: Table | string,
oldTableColumnOrName: TableColumn | string,
newTableColumnOrName: TableColumn | string,
): Promise<void> {
const table = InstanceChecker.isTable(tableOrName)
? tableOrName
: await this.getCachedTable(tableOrName);
const oldColumn = InstanceChecker.isTableColumn(oldTableColumnOrName)
? oldTableColumnOrName
: table.columns.find((c) => c.name === oldTableColumnOrName);
if (!oldColumn)
throw new TypeORMError(
`Column "${oldTableColumnOrName}" was not found in the "${table.name}" table.`,
);
let newColumn: TableColumn | undefined = undefined;
if (InstanceChecker.isTableColumn(newTableColumnOrName)) {
newColumn = newTableColumnOrName;
} else {
newColumn = oldColumn.clone();
newColumn.name = newTableColumnOrName;
}
return this.changeColumn(table, oldColumn, newColumn);
}
/**
* Changes a column in the table.
*/
async changeColumn(View on GitHub (pinned to 5ac6606e81)
Solutions
- Verify the exact current column name in the DB/schema before renaming.
- Ensure migrations run in strict order — the column must exist first.
- Re-fetch the table via getCachedTable() if metadata may be stale.
- Double-check spelling and case (SQLite identifiers are case-insensitive but typos still miss).
Example fix
// before
await queryRunner.renameColumn('user', 'firstName', 'givenName');
// after
const table = await queryRunner.getTable('user');
if (table?.findColumnByName('firstName')) {
await queryRunner.renameColumn('user', 'firstName', 'givenName');
} Defensive patterns
Strategy: validation
Validate before calling
const table = await queryRunner.getTable('user');
if (!table?.findColumnByName('firstName')) {
throw new Error('Cannot rename: column firstName does not exist');
}
await queryRunner.renameColumn(table!, 'firstName', 'givenName'); Type guard
const columnExists = async (qr: QueryRunner, tableName: string, col: string): Promise<boolean> => Boolean((await qr.getTable(tableName))?.findColumnByName(col));
Prevention
- Verify the current column name against the live schema before renaming.
- Keep migrations strictly ordered.
- Re-fetch table metadata when it may be stale.
When it happens
Trigger: Calling renameColumn(table, 'oldName', 'newName') where 'oldName' is not a column, or passing a stale Table object whose columns do not reflect the live database.
Common situations: Migration ordering (renaming a column before the migration that adds it), a typo in the column name, running migrations out of order, or the cached table metadata being stale.
Related errors
- Column "${columnOrName}" was not found in table "${table.nam
- Column "${column}" was not found in table "${table.name}"
- 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}
AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12).
Data as JSON: /api/errors/2d277fc587f8f8c1.
Report an issue: GitHub.