{"record":{"id":"97c49afb790f16ae","repo":"hibernate/hibernate-orm","slug":"unrecognized-graph-parser-mode-value-graphpa","errorCode":null,"errorMessage":"Unrecognized graph_parser_mode value : \" + graphParserMode + \".  Supported values include 'modern' and 'legacy'.","messagePattern":"Unrecognized graph_parser_mode value : \" \\+ graphParserMode \\+ \"\\.  Supported values include 'modern' and 'legacy'\\.","errorType":"exception","errorClass":"HibernateException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/GraphParserMode.java","lineNumber":57,"sourceCode":"\t * @param graphParserMode configured {@link GraphParserMode} representation\n\t *\n\t * @return associated {@link GraphParserMode} object\n\t */\n\tpublic static GraphParserMode interpret(Object graphParserMode) {\n\t\tif ( graphParserMode == null ) {\n\t\t\treturn LEGACY;\n\t\t}\n\t\telse if ( graphParserMode instanceof GraphParserMode mode ) {\n\t\t\treturn mode;\n\t\t}\n\t\telse if ( graphParserMode instanceof String string ) {\n\t\t\tfor ( GraphParserMode value : values() ) {\n\t\t\t\tif ( value.name().equalsIgnoreCase( string ) ) {\n\t\t\t\t\treturn value;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tthrow new HibernateException(\n\t\t\t\t\"Unrecognized graph_parser_mode value : \" + graphParserMode\n\t\t\t\t\t\t+ \".  Supported values include 'modern' and 'legacy'.\"\n\t\t);\n\t}\n}\n","sourceCodeStart":39,"sourceCodeEnd":63,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/GraphParserMode.java#L39-L63","documentation":"GraphParserMode.interpret parses the 'hibernate.graph_parser_mode' setting: null returns LEGACY (default), a GraphParserMode instance is passed through, and a String is matched case-insensitively against MODERN/LEGACY. Any other object or unrecognized string throws HibernateException listing the supported values 'modern' and 'legacy'. This controls the syntax accepted by EntityGraph parsing (e.g. attribute:SubType(...) vs legacy attribute(SubType: ...)).","triggerScenarios":"Setting the property 'hibernate.graph_parser_mode' in persistence.xml/hibernate.properties to anything other than modern/legacy - e.g. 'new', 'default', 'on', or a non-string object - then building the SessionFactory (SessionFactoryOptionsBuilder reads the setting).","commonSituations":"Upgrading Hibernate 6.x to 7.x and guessing at the new setting's value; YAML/env-injected config with a stray boolean or typo; documentation drift between versions using different property names/values.","solutions":["Set the value to 'modern' or 'legacy' (case-insensitive).","Remove the property entirely - a missing/null setting defaults to LEGACY.","If the value comes from an external source, validate it is one of the two accepted strings before startup."],"exampleFix":"<!-- before -->\n<property name=\"hibernate.graph_parser_mode\" value=\"new\"/>\n\n<!-- after -->\n<property name=\"hibernate.graph_parser_mode\" value=\"modern\"/>","handlingStrategy":"validation","validationCode":"static String normalizeGraphParserMode(String raw) {\n    if (raw == null) return null; // defaults to LEGACY\n    for (GraphParserMode m : GraphParserMode.values()) {\n        if (m.name().equalsIgnoreCase(raw.trim())) return m.getConfigValue();\n    }\n    throw new IllegalArgumentException(\"graph_parser_mode must be 'modern' or 'legacy', got: \" + raw);\n}","typeGuard":null,"tryCatchPattern":"try {\n    SessionFactory sf = cfg.buildSessionFactory();\n} catch (HibernateException e) {\n    if (e.getMessage().contains(\"graph_parser_mode\")) {\n        cfg.getStandardServiceRegistryBuilder().clearSettings(); // drop bad value, rebuild with default\n    }\n    throw e;\n}","preventionTips":["Keep an allowed-values list next to config definitions and validate at app start","Use config linting/tests that boot the SessionFactory in CI"],"tags":["entity-graph","configuration","graph-parser","bootstrap","hibernate-exception"],"backgroundTag":"invalid-enum-config-value","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}