{"record":{"id":"49743bc925c2d6f2","repo":"hibernate/hibernate-orm","slug":"graphsemantic-option-was-specified-but-no-graph-w","errorCode":null,"errorMessage":"GraphSemantic option was specified, but no Graph was supplied","messagePattern":"GraphSemantic option was specified, but no Graph was supplied","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/internal/find/AbstractFindByKeyOperation.java","lineNumber":164,"sourceCode":"\t\t\t\t}\n\t\t\t\telse if ( option instanceof Locking.FollowOn followOn ) {\n\t\t\t\t\tthis.lockFollowOn = followOn;\n\t\t\t\t}\n\t\t\t\telse if ( option instanceof Timeout timeout ) {\n\t\t\t\t\tthis.lockTimeout = timeout;\n\t\t\t\t}\n\t\t\t\telse if ( option instanceof ReadOnlyMode readOnlyMode ) {\n\t\t\t\t\tthis.readOnlyMode = readOnlyMode;\n\t\t\t\t}\n\t\t\t\telse if ( option instanceof EnabledFetchProfile enabledFetchProfile ) {\n\t\t\t\t\tthis.enabledFetchProfile( enabledFetchProfile.profileName() );\n\t\t\t\t}\n\t\t\t\telse if ( option instanceof NaturalIdSynchronization naturalIdSynchronization ) {\n\t\t\t\t\tthis.naturalIdSynchronization = naturalIdSynchronization;\n\t\t\t\t}\n\t\t\t\telse if ( option instanceof GraphSemantic graphSemanticOption ) {\n\t\t\t\t\tif ( rootGraph == null ) {\n\t\t\t\t\t\tthrow new IllegalArgumentException(\n\t\t\t\t\t\t\t\t\"GraphSemantic option was specified, but no Graph was supplied\" );\n\t\t\t\t\t}\n\t\t\t\t\tthis.graphSemantic = graphSemanticOption;\n\t\t\t\t}\n\t\t\t\telse if ( option instanceof FindMultipleOption findMultipleOption ) {\n\t\t\t\t\tthrow new IllegalArgumentException(\n\t\t\t\t\t\t\t\"Option '\" + findMultipleOption + \"' can only be used in 'findMultiple()'\" );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate void enabledFetchProfile(String profileName) {\n\t\tif ( enabledFetchProfiles == null ) {\n\t\t\tenabledFetchProfiles = new HashSet<>();\n\t\t}\n\t\tenabledFetchProfiles.add( profileName );\n\t}","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/internal/find/AbstractFindByKeyOperation.java#L146-L182","documentation":"Error \"GraphSemantic option was specified, but no Graph was supplied\" thrown in hibernate/hibernate-orm.","triggerScenarios":"Thrown at hibernate-core/src/main/java/org/hibernate/internal/find/AbstractFindByKeyOperation.java:164 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["When specifying a GraphSemantic (FETCH/LOAD), also supply the corresponding EntityGraph via the graph option.","Remove the GraphSemantic option if no graph is needed."],"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"}