{"record":{"id":"e20687b72d63e99e","repo":"hibernate/hibernate-orm","slug":"could-not-locate-field-name-s-on-class-s","errorCode":null,"errorMessage":"Could not locate field name [%s] on class [%s]","messagePattern":"Could not locate field name \\[(.+?)\\] on class \\[(.+?)\\]","errorType":"exception","errorClass":"PropertyNotFoundException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/internal/util/ReflectHelper.java","lineNumber":398,"sourceCode":"\t\ttry {\n\t\t\treturn clazz.getMethod( methodName, paramTypes );\n\t\t}\n\t\tcatch (Exception e) {\n\t\t\treturn null;\n\t\t}\n\t}\n\n\tpublic static Field findField(Class<?> containerClass, String propertyName) {\n\t\tif ( containerClass == null ) {\n\t\t\tthrow new IllegalArgumentException( \"Class<?> on which to find field [\" + propertyName + \"] cannot be null\" );\n\t\t}\n\t\telse if ( containerClass == Object.class ) {\n\t\t\tthrow new IllegalArgumentException( \"Illegal attempt to locate field [\" + propertyName + \"] on Object.class\" );\n\t\t}\n\t\telse {\n\t\t\tfinal Field field = locateField( containerClass, propertyName );\n\t\t\tif ( field == null ) {\n\t\t\t\tthrow new PropertyNotFoundException(\n\t\t\t\t\t\tString.format(\n\t\t\t\t\t\t\t\tLocale.ROOT,\n\t\t\t\t\t\t\t\t\"Could not locate field name [%s] on class [%s]\",\n\t\t\t\t\t\t\t\tpropertyName,\n\t\t\t\t\t\t\t\tcontainerClass.getName()\n\t\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t}\n\t\t\tensureAccessibility( field );\n\t\t\treturn field;\n\t\t}\n\t}\n\n\tpublic static void ensureAccessibility(AccessibleObject accessibleObject) {\n\t\tif ( !accessibleObject.isAccessible() ) {\n\t\t\taccessibleObject.setAccessible( true );\n\t\t}\n\t}","sourceCodeStart":380,"sourceCodeEnd":416,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/internal/util/ReflectHelper.java#L380-L416","documentation":"Error \"Could not locate field name [%s] on class [%s]\" thrown in hibernate/hibernate-orm.","triggerScenarios":"Thrown at hibernate-core/src/main/java/org/hibernate/internal/util/ReflectHelper.java:398 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the property/field name exists on the class (check spelling and mapping); fields in superclasses are only found when walking the hierarchy."],"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"}