{"record":{"id":"e8e0b270d5118655","repo":"hibernate/hibernate-orm","slug":"option-findmultipleoption-can-only-be-us","errorCode":null,"errorMessage":"Option '\" + findMultipleOption + \"' can only be used in 'findMultiple()'","messagePattern":"Option '\" \\+ findMultipleOption \\+ \"' can only be used in 'findMultiple\\(\\)'","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/internal/find/AbstractFindByKeyOperation.java","lineNumber":170,"sourceCode":"\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}\n\n\tpublic EntityPersister getEntityDescriptor() {\n\t\treturn entityDescriptor;\n\t}\n\n\tpublic KeyType getKeyType() {","sourceCodeStart":152,"sourceCodeEnd":188,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/internal/find/AbstractFindByKeyOperation.java#L152-L188","documentation":"Error \"Option '\" + findMultipleOption + \"' can only be used in 'findMultiple()'\" thrown in hibernate/hibernate-orm.","triggerScenarios":"Thrown at hibernate-core/src/main/java/org/hibernate/internal/find/AbstractFindByKeyOperation.java:170 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use the option only with findMultiple(); for single find, remove the findMultiple-only option."],"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"}