{"record":{"id":"bb70987c70cbbd72","repo":"n8n-io/n8n","slug":"property-propertypath-was-not-found-in-met-bb7098","errorCode":null,"errorMessage":"Property \"${propertyPath}\" was not found in \"${metadata.targetName}\". Make sure your query is correct.","messagePattern":"Property \"(.+?)\" was not found in \"(.+?)\"\\. Make sure your query is correct\\.","errorType":"exception","errorClass":"EntityPropertyNotFoundError","httpStatus":null,"severity":"error","filePath":"packages/@n8n/typeorm/src/metadata/EntityMetadata.ts","lineNumber":763,"sourceCode":"\thasEmbeddedWithPropertyPath(propertyPath: string): boolean {\n\t\treturn this.allEmbeddeds.some((embedded) => embedded.propertyPath === propertyPath);\n\t}\n\n\t/**\n\t * Finds embedded with a given property path.\n\t */\n\tfindEmbeddedWithPropertyPath(propertyPath: string): EmbeddedMetadata | undefined {\n\t\treturn this.allEmbeddeds.find((embedded) => embedded.propertyPath === propertyPath);\n\t}\n\n\t/**\n\t * Returns an array of databaseNames mapped from provided propertyPaths\n\t */\n\tmapPropertyPathsToColumns(propertyPaths: string[]) {\n\t\treturn propertyPaths.map((propertyPath) => {\n\t\t\tconst column = this.findColumnWithPropertyPath(propertyPath);\n\t\t\tif (column == null) {\n\t\t\t\tthrow new EntityPropertyNotFoundError(propertyPath, this);\n\t\t\t}\n\t\t\treturn column;\n\t\t});\n\t}\n\n\t/**\n\t * Iterates through entity and finds and extracts all values from relations in the entity.\n\t * If relation value is an array its being flattened.\n\t */\n\textractRelationValuesFromEntity(\n\t\tentity: ObjectLiteral,\n\t\trelations: RelationMetadata[],\n\t): [RelationMetadata, any, EntityMetadata][] {\n\t\tconst relationsAndValues: [RelationMetadata, any, EntityMetadata][] = [];\n\t\trelations.forEach((relation) => {\n\t\t\tconst value = relation.getEntityValue(entity);\n\t\t\tif (Array.isArray(value)) {\n\t\t\t\tvalue.forEach((subValue) =>","sourceCodeStart":745,"sourceCodeEnd":781,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/typeorm/src/metadata/EntityMetadata.ts#L745-L781","documentation":"Thrown by EntityMetadata.mapPropertyPathsToColumns when a property path supplied in a query (select, where relations, orderBy, addSelect) cannot be resolved to any column on the entity. The class is EntityPropertyNotFoundError and its constructor receives the offending path and the entity metadata, so the message names both. This runs at query-build time, not at startup.","triggerScenarios":"Calling repo.find({ select: ['nonExistent'] }), createQueryBuilder().orderBy('wrong.path'), or passing a dotted path through a non-embedded relation. Any API that internally calls mapPropertyPathsToColumns with a path that findColumnWithPropertyPath returns null for.","commonSituations":"Renaming a column but leaving stale string literals in select/where options; using the database column name instead of the TypeScript property name; referencing a relation property without navigating it correctly; refactors that drop a field.","solutions":["Open the entity class and confirm the exact @Column/@Relation property name; TypeORM matches on propertyPath, not databaseName.","Replace the string literal with the actual property name (or use FindOptionsSelect / a typed query builder to get compile-time checking).","For nested/embedded paths, use the correct dotted notation matching propertyPath (e.g. 'profile.address.city')."],"exampleFix":"// before\nawait repo.find({ select: ['user_name'] }); // DB name, wrong\n\n// after\nawait repo.find({ select: ['userName'] }); // TS property name","handlingStrategy":"validation","validationCode":"import type { EntityMetadata } from 'typeorm';\n\nfunction assertPropertyPaths(\n  metadata: EntityMetadata,\n  paths: string[],\n): void {\n  const known = new Set(metadata.columns.map((c) => c.propertyPath));\n  for (const p of paths) {\n    if (!known.has(p)) {\n      throw new Error(`Unknown property path '${p}' on ${metadata.targetName}`);\n    }\n  }\n}\n\n// before querying\nassertPropertyPaths(dataSource.getMetadata(User), ['userName', 'email']);","typeGuard":"import type { FindOptionsSelect } from 'typeorm';\n// Using a typed select forces the compiler to reject unknown keys\nconst select: FindOptionsSelect<User> = { userName: true, email: true };","tryCatchPattern":"import { EntityPropertyNotFoundError } from 'typeorm';\n\ntry {\n  await repo.find({ select: fields });\n} catch (err) {\n  if (err instanceof EntityPropertyNotFoundError) {\n    // log, drop the bad path, and retry with the validated subset\n  } else throw err;\n}","preventionTips":["Prefer FindOptionsSelect<Entity> / typed query builders over string arrays so the compiler catches typos.","Run an entity-metadata smoke test at boot that exercises every select/where path your code uses.","When renaming a column, grep for the old name in string literals across the codebase."],"tags":["property-path","select","query","runtime"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}