{"record":{"id":"d5ca2eb946eb8e91","repo":"n8n-io/n8n","slug":"column-columnorname-was-not-found-in-table","errorCode":null,"errorMessage":"Column \"${columnOrName}\" was not found in table \"${table.name}\"","messagePattern":"Column \"(.+?)\" was not found in table \"(.+?)\"","errorType":"exception","errorClass":"TypeORMError","httpStatus":null,"severity":"error","filePath":"packages/@n8n/typeorm/src/driver/sqlite-abstract/AbstractSqliteQueryRunner.ts","lineNumber":664,"sourceCode":"\t\t\t\tchangedTable.columns[changedTable.columns.indexOf(originalColumn)] =\n\t\t\t\t\tchangedColumnSet.newColumn;\n\t\t});\n\n\t\tawait this.recreateTable(changedTable, table);\n\t}\n\n\t/**\n\t * Drops column in the table.\n\t */\n\tasync dropColumn(tableOrName: Table | string, columnOrName: TableColumn | string): Promise<void> {\n\t\tconst table = InstanceChecker.isTable(tableOrName)\n\t\t\t? tableOrName\n\t\t\t: await this.getCachedTable(tableOrName);\n\t\tconst column = InstanceChecker.isTableColumn(columnOrName)\n\t\t\t? columnOrName\n\t\t\t: table.findColumnByName(columnOrName);\n\t\tif (!column)\n\t\t\tthrow new TypeORMError(`Column \"${columnOrName}\" was not found in table \"${table.name}\"`);\n\n\t\tawait this.dropColumns(table, [column]);\n\t}\n\n\t/**\n\t * Drops the columns in the table.\n\t */\n\tasync dropColumns(tableOrName: Table | string, columns: TableColumn[] | string[]): Promise<void> {\n\t\tconst table = InstanceChecker.isTable(tableOrName)\n\t\t\t? tableOrName\n\t\t\t: await this.getCachedTable(tableOrName);\n\n\t\t// clone original table and remove column and its constraints from cloned table\n\t\tconst changedTable = table.clone();\n\t\tcolumns.forEach((column: TableColumn | string) => {\n\t\t\tconst columnInstance = InstanceChecker.isTableColumn(column)\n\t\t\t\t? column\n\t\t\t\t: table.findColumnByName(column);","sourceCodeStart":646,"sourceCodeEnd":682,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/typeorm/src/driver/sqlite-abstract/AbstractSqliteQueryRunner.ts#L646-L682","documentation":"dropColumn() resolves the column by name against the cached table metadata; if none matches it throws TypeORMError. You are trying to drop a column that does not exist in the table definition TypeORM has loaded.","triggerScenarios":"Calling dropColumn(table, 'colName') where 'colName' is not a column in the cached table.","commonSituations":"Re-running a migration that already dropped the column, typo in the name, a prior migration renamed it, or stale cached metadata.","solutions":["Verify the column still exists in the live schema before dropping.","Make the drop idempotent — check existence first.","Re-fetch the table via getTable()/getCachedTable() if metadata may be stale.","Use up() that guards against already-applied state."],"exampleFix":"// before\nawait queryRunner.dropColumn('user', 'legacyField');\n\n// after\nconst table = await queryRunner.getTable('user');\nif (table?.findColumnByName('legacyField')) {\n  await queryRunner.dropColumn(table!, 'legacyField');\n}","handlingStrategy":"validation","validationCode":"const table = await queryRunner.getTable('user');\nif (table?.findColumnByName('legacyField')) {\n  await queryRunner.dropColumn(table!, 'legacyField');\n}","typeGuard":"const columnExists = async (qr: QueryRunner, tableName: string, col: string): Promise<boolean> =>\n  Boolean((await qr.getTable(tableName))?.findColumnByName(col));","tryCatchPattern":null,"preventionTips":["Make drop migrations idempotent — check existence first.","Avoid re-running migrations against already-migrated DBs.","Re-fetch table metadata when stale."],"tags":["database","migration","sqlite"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}