{"record":{"id":"00db667dbfd8435a","repo":"n8n-io/n8n","slug":"column-propertypath-was-not-found-in-metadata","errorCode":null,"errorMessage":"Column ${propertyPath} was not found in ${metadata.targetName} entity.","messagePattern":"Column (.+?) was not found in (.+?) entity\\.","errorType":"exception","errorClass":"TypeORMError","httpStatus":null,"severity":"error","filePath":"packages/@n8n/typeorm/src/entity-manager/EntityManager.ts","lineNumber":1176,"sourceCode":"\t\t\treturn await queryRunner.clearTable(metadata.tablePath); // await is needed here because we are using finally\n\t\t} finally {\n\t\t\tif (!this.queryRunner) await queryRunner.release();\n\t\t}\n\t}\n\n\t/**\n\t * Increments some column by provided value of the entities matched given conditions.\n\t */\n\tasync increment<Entity extends ObjectLiteral>(\n\t\tentityClass: EntityTarget<Entity>,\n\t\tconditions: any,\n\t\tpropertyPath: string,\n\t\tvalue: number | string,\n\t): Promise<UpdateResult> {\n\t\tconst metadata = this.connection.getMetadata(entityClass);\n\t\tconst column = metadata.findColumnWithPropertyPath(propertyPath);\n\t\tif (!column)\n\t\t\tthrow new TypeORMError(\n\t\t\t\t`Column ${propertyPath} was not found in ${metadata.targetName} entity.`,\n\t\t\t);\n\n\t\tif (isNaN(Number(value))) throw new TypeORMError(`Value \"${value}\" is not a number.`);\n\n\t\t// convert possible embeded path \"social.likes\" into object { social: { like: () => value } }\n\t\tconst values: QueryDeepPartialEntity<Entity> = propertyPath.split('.').reduceRight(\n\t\t\t(value, key) => ({ [key]: value }) as any,\n\t\t\t() => this.connection.driver.escape(column.databaseName) + ' + ' + value,\n\t\t);\n\n\t\treturn this.createQueryBuilder<Entity>(entityClass as any, 'entity')\n\t\t\t.update(entityClass)\n\t\t\t.set(values)\n\t\t\t.where(conditions)\n\t\t\t.execute();\n\t}\n","sourceCodeStart":1158,"sourceCodeEnd":1194,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/typeorm/src/entity-manager/EntityManager.ts#L1158-L1194","documentation":"EntityManager.increment resolves the propertyPath against entity metadata via findColumnWithPropertyPath. If no column metadata matches, it throws a TypeORMError naming the propertyPath and the entity targetName. Mirrors the aggregate column-not-found case but on the write path. The DB schema is not consulted — only @Column/@Embedded-decorated properties.","triggerScenarios":"Calling `manager.increment(Entity, { id: 1 }, 'count', 1)` where `count` is not a @Column (maybe a getter, a relation, or a virtual field); passing a database column name instead of the property name; targeting a column added by migration but not yet decorated on the entity; passing a relation path like `'tags'`.","commonSituations":"Rename of a property that didn't update all increment call sites; migration added a column but the entity class wasn't regenerated; confusion between DB column names and TS property names; attempting to increment an embedded or computed field.","solutions":["Pass the @Column-decorated property name (the TS field name), not the DB column name.","After schema changes, regenerate or hand-update the entity so findColumnWithPropertyPath resolves.","For embedded columns, pass the full dotted path that matches an EmbeddedMetadata column.","If you actually need to bump a non-decorated column, use a raw query builder update instead."],"exampleFix":"// before\nawait manager.increment(Counter, { id }, 'hit_count', 1);\n// entity has @Column() hitCount!: number\n\n// after - use the decorated property name\n@Entity()\nclass Counter { @Column() hitCount!: number; }\nawait manager.increment(Counter, { id }, 'hitCount', 1);","handlingStrategy":"type-guard","validationCode":"const meta = connection.getMetadata(Entity);\nif (!meta.findColumnWithPropertyPath(propertyPath)) {\n  throw new Error(`Refusing increment: ${propertyPath} is not a mapped column`);\n}\nawait manager.increment(Entity, conditions, propertyPath, value);","typeGuard":"function isIncrementableColumn<Entity>(meta: import('@n8n/typeorm').EntityMetadata<Entity>, path: string): boolean {\n  const col = meta.findColumnWithPropertyPath(path);\n  return !!col && col.type === Number;\n}","tryCatchPattern":null,"preventionTips":["Pass @Column property names, not DB column names.","Keep entities in sync with migrations.","Grep for `manager.increment(` when renaming numeric columns.","Type propertyPath as keyof Entity, not string."],"tags":["typeorm","increment","metadata","api-misuse"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}