{"record":{"id":"8e39075defd35aa1","repo":"n8n-io/n8n","slug":"select-column-was-not-found-in-the-metadata-n","errorCode":null,"errorMessage":"${select} column was not found in the ${metadata.name} entity.","messagePattern":"(.+?) column was not found in the (.+?) entity\\.","errorType":"exception","errorClass":"TypeORMError","httpStatus":null,"severity":"error","filePath":"packages/@n8n/typeorm/src/find-options/FindOptionsUtils.ts","lineNumber":117,"sourceCode":"        if (!qb.expressionMap.mainAlias || !qb.expressionMap.mainAlias.hasMetadata)\n            return qb;\n\n        const metadata = qb.expressionMap.mainAlias!.metadata;\n\n        // apply all options from FindOptions\n        if (options.comment) {\n            qb.comment(options.comment);\n        }\n\n        if (options.withDeleted) {\n            qb.withDeleted();\n        }\n\n        if (options.select) {\n            qb.select([]);\n            options.select.forEach(select => {\n                if (!metadata.hasColumnWithPropertyPath(`${select}`))\n                    throw new TypeORMError(`${select} column was not found in the ${metadata.name} entity.`);\n\n                const columns = metadata.findColumnsWithPropertyPath(`${select}`);\n\n                for (const column of columns) {\n                    qb.addSelect(qb.alias + \".\" + column.propertyPath);\n                }\n            });\n        }\n\n        if (options.relations) {\n            // Copy because `applyRelationsRecursively` modifies it\n            const allRelations = [...options.relations];\n            this.applyRelationsRecursively(qb, allRelations, qb.expressionMap.mainAlias!.name, qb.expressionMap.mainAlias!.metadata, \"\");\n            // recursive removes found relations from allRelations array\n            // if there are relations left in this array it means those relations were not found in the entity structure\n            // so, we give an exception about not found relations\n            if (allRelations.length > 0)\n                throw new FindRelationsNotFoundError(allRelations);","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/typeorm/src/find-options/FindOptionsUtils.ts#L99-L135","documentation":"FindOptionsUtils.applyFindOptions (the findOne/manyOptions path) iterates each entry of options.select and verifies via metadata.hasColumnWithPropertyPath. If any selection doesn't resolve to a known column, it throws `${select} column was not found in the ${metadata.name} entity.` The check uses the TS property path, not the DB column name.","triggerScenarios":"Passing `select: ['total_price']` (DB name) instead of `['totalPrice']` (property name); selecting a relation field or getter that isn't a @Column; selecting a column after a rename that wasn't propagated to all call sites; selecting an embedded column without the full path.","commonSituations":"Rename refactor missing call sites; migration added a column not yet on the entity; confusion between snake_case DB names and camelCase TS properties; selecting a virtual/computed property.","solutions":["Use the entity property name in `select`, matching the @Column-decorated field.","Update or regenerate the entity after schema changes so metadata has the new columns.","For embedded values, supply the full property path.","Grep `select: [` usages when renaming any column."],"exampleFix":"// before\nawait repo.find({ select: ['total_price', 'user_id'] });\n\n// after - use property names\n@Entity()\nclass Order {\n  @Column() totalPrice!: number;\n  @Column() userId!: number;\n}\nawait repo.find({ select: ['totalPrice', 'userId'] });","handlingStrategy":"validation","validationCode":"function validateSelect<Entity>(meta: import('@n8n/typeorm').EntityMetadata<Entity>, select: readonly string[]): void {\n  for (const s of select) {\n    if (!meta.hasColumnWithPropertyPath(s)) {\n      throw new Error(`select: ${s} is not a mapped column on ${meta.name}`);\n    }\n  }\n}\nconst meta = connection.getMetadata(Entity);\nvalidateSelect(meta, options.select ?? []);\nawait repo.find(options);","typeGuard":"function isSelectableKey<Entity>(meta: import('@n8n/typeorm').EntityMetadata<Entity>, key: string): boolean {\n  return meta.hasColumnWithPropertyPath(key);\n}","tryCatchPattern":null,"preventionTips":["Use property names (camelCase) in select, not DB column names.","Regenerate entities after migrations.","Grep `select: [` when renaming columns.","Type select as Array<keyof Entity>."],"tags":["typeorm","find-options","select","metadata"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}