{"record":{"id":"f0257c6b42c99cea","repo":"n8n-io/n8n","slug":"supplied-index-indexorname-was-not-found-in-tab","errorCode":null,"errorMessage":"Supplied index ${indexOrName} was not found in table ${table.name}","messagePattern":"Supplied index (.+?) was not found in table (.+?)","errorType":"exception","errorClass":"TypeORMError","httpStatus":null,"severity":"error","filePath":"packages/@n8n/typeorm/src/driver/sqlite-abstract/AbstractSqliteQueryRunner.ts","lineNumber":1019,"sourceCode":"\t * Creates a new indices\n\t */\n\tasync createIndices(tableOrName: Table | string, indices: TableIndex[]): Promise<void> {\n\t\tconst promises = indices.map((index) => this.createIndex(tableOrName, index));\n\t\tawait Promise.all(promises);\n\t}\n\n\t/**\n\t * Drops an index from the table.\n\t */\n\tasync dropIndex(tableOrName: Table | string, indexOrName: TableIndex | 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 index = InstanceChecker.isTableIndex(indexOrName)\n\t\t\t? indexOrName\n\t\t\t: table.indices.find((i) => i.name === indexOrName);\n\t\tif (!index)\n\t\t\tthrow new TypeORMError(`Supplied index ${indexOrName} was not found in table ${table.name}`);\n\n\t\t// old index may be passed without name. In this case we generate index name manually.\n\t\tif (!index.name) index.name = this.generateIndexName(table, index);\n\n\t\tconst up = this.dropIndexSql(index);\n\t\tconst down = this.createIndexSql(table, index);\n\t\tawait this.executeQueries(up, down);\n\t\ttable.removeIndex(index);\n\t}\n\n\t/**\n\t * Drops an indices from the table.\n\t */\n\tasync dropIndices(tableOrName: Table | string, indices: TableIndex[]): Promise<void> {\n\t\tconst promises = indices.map((index) => this.dropIndex(tableOrName, index));\n\t\tawait Promise.all(promises);\n\t}\n","sourceCodeStart":1001,"sourceCodeEnd":1037,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/typeorm/src/driver/sqlite-abstract/AbstractSqliteQueryRunner.ts#L1001-L1037","documentation":"dropIndex() resolves the index by name (or object) against the cached table; if none matches it throws TypeORMError. The index you are trying to drop does not exist in the table definition TypeORM has loaded.","triggerScenarios":"Calling dropIndex(table, 'indexName') where 'indexName' is not present in table.indices of the cached table.","commonSituations":"Re-running a migration that already dropped it, a typo in the index name, a prior migration removed it, or stale cached metadata.","solutions":["Resolve the actual index name from the live schema via getTable().indices before dropping.","Make the drop idempotent — check existence first.","Re-fetch the table via getTable() if metadata may be stale."],"exampleFix":"// before\nawait queryRunner.dropIndex('user', 'IDX_user_email');\n\n// after\nconst table = await queryRunner.getTable('user');\nif (table?.indices.some((i) => i.name === 'IDX_user_email')) {\n  await queryRunner.dropIndex(table!, 'IDX_user_email');\n}","handlingStrategy":"validation","validationCode":"const table = await queryRunner.getTable('user');\nif (table?.indices.some((i) => i.name === 'IDX_user_email')) {\n  await queryRunner.dropIndex(table!, 'IDX_user_email');\n}","typeGuard":"const indexExists = async (qr: QueryRunner, tableName: string, name: string): Promise<boolean> =>\n  Boolean((await qr.getTable(tableName))?.indices.some((i) => i.name === name));","tryCatchPattern":null,"preventionTips":["Resolve the real index name from the live schema.","Make index drops idempotent.","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-13T19:17:28.613Z"}