n8n-io/n8n · error · TypeORMError

${select} column was not found in the ${metadata.name} entit

Error message

${select} column was not found in the ${metadata.name} entity.

What it means

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.

Source

Thrown at packages/@n8n/typeorm/src/find-options/FindOptionsUtils.ts:117

        if (!qb.expressionMap.mainAlias || !qb.expressionMap.mainAlias.hasMetadata)
            return qb;

        const metadata = qb.expressionMap.mainAlias!.metadata;

        // apply all options from FindOptions
        if (options.comment) {
            qb.comment(options.comment);
        }

        if (options.withDeleted) {
            qb.withDeleted();
        }

        if (options.select) {
            qb.select([]);
            options.select.forEach(select => {
                if (!metadata.hasColumnWithPropertyPath(`${select}`))
                    throw new TypeORMError(`${select} column was not found in the ${metadata.name} entity.`);

                const columns = metadata.findColumnsWithPropertyPath(`${select}`);

                for (const column of columns) {
                    qb.addSelect(qb.alias + "." + column.propertyPath);
                }
            });
        }

        if (options.relations) {
            // Copy because `applyRelationsRecursively` modifies it
            const allRelations = [...options.relations];
            this.applyRelationsRecursively(qb, allRelations, qb.expressionMap.mainAlias!.name, qb.expressionMap.mainAlias!.metadata, "");
            // recursive removes found relations from allRelations array
            // if there are relations left in this array it means those relations were not found in the entity structure
            // so, we give an exception about not found relations
            if (allRelations.length > 0)
                throw new FindRelationsNotFoundError(allRelations);

View on GitHub (pinned to 5ac6606e81)

Solutions

  1. Use the entity property name in `select`, matching the @Column-decorated field.
  2. Update or regenerate the entity after schema changes so metadata has the new columns.
  3. For embedded values, supply the full property path.
  4. Grep `select: [` usages when renaming any column.

Example fix

// before
await repo.find({ select: ['total_price', 'user_id'] });

// after - use property names
@Entity()
class Order {
  @Column() totalPrice!: number;
  @Column() userId!: number;
}
await repo.find({ select: ['totalPrice', 'userId'] });
Defensive patterns

Strategy: validation

Validate before calling

function validateSelect<Entity>(meta: import('@n8n/typeorm').EntityMetadata<Entity>, select: readonly string[]): void {
  for (const s of select) {
    if (!meta.hasColumnWithPropertyPath(s)) {
      throw new Error(`select: ${s} is not a mapped column on ${meta.name}`);
    }
  }
}
const meta = connection.getMetadata(Entity);
validateSelect(meta, options.select ?? []);
await repo.find(options);

Type guard

function isSelectableKey<Entity>(meta: import('@n8n/typeorm').EntityMetadata<Entity>, key: string): boolean {
  return meta.hasColumnWithPropertyPath(key);
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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