{"record":{"id":"928b8414a85f1f59","repo":"hibernate/hibernate-orm","slug":"property-property-refers-to-an-unknown-fetch","errorCode":null,"errorMessage":"Property '${property}' refers to an unknown fetch profile named '${profileName}'","messagePattern":"Property '(.+?)' refers to an unknown fetch profile named '(.+?)'","errorType":"exception","errorClass":"AnnotationException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/boot/model/internal/FetchSecondPass.java","lineNumber":45,"sourceCode":"\tprivate final MetadataBuildingContext buildingContext;\n\n\tpublic FetchSecondPass(\n\t\t\tFetchProfileOverride fetch,\n\t\t\tPropertyHolder propertyHolder,\n\t\t\tString propertyName,\n\t\t\tMetadataBuildingContext buildingContext) {\n\t\tthis.fetch = fetch;\n\t\tthis.propertyHolder = propertyHolder;\n\t\tthis.propertyName = propertyName;\n\t\tthis.buildingContext = buildingContext;\n\t}\n\n\t@Override\n\tpublic void doSecondPass(Map<String, PersistentClass> persistentClasses) throws MappingException {\n\t\tfinal String profileName = fetch.profile();\n\t\tfinal var profile = buildingContext.getMetadataCollector().getFetchProfile( profileName );\n\t\tif ( profile == null ) {\n\t\t\tthrow new AnnotationException(\n\t\t\t\t\t\"Property '\" + qualify( propertyHolder.getPath(), propertyName )\n\t\t\t\t\t\t\t+ \"' refers to an unknown fetch profile named '\" + profileName + \"'\"\n\t\t\t);\n\t\t}\n\n\t\tif ( profile.getSource() == ANNOTATIONS ) {\n\t\t\tprofile.addFetch( new FetchProfile.Fetch(\n\t\t\t\t\tpropertyHolder.getEntityName(),\n\t\t\t\t\tpropertyName,\n\t\t\t\t\tfetch.mode(),\n\t\t\t\t\tfetch.fetch()\n\t\t\t) );\n\t\t}\n\t\t// otherwise, it's a fetch profile defined in XML, and it overrides\n\t\t// the annotations, so we simply ignore this annotation completely\n\t}\n}\n","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/boot/model/internal/FetchSecondPass.java#L27-L63","documentation":"Error \"Property '${property}' refers to an unknown fetch profile named '${profileName}'\" thrown in hibernate/hibernate-orm.","triggerScenarios":"A named entity graph / fetch declaration references unknown or incompatible types, attributes, or subgraphs.","commonSituations":"@Fetch pointing at an unknown graph, subgraph types that are not subtypes of the attribute type, or conflicting fetch options for the same attribute.","solutions":["Correct the fetch profile name, or define the profile with @FetchProfile."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}