{"record":{"id":"c98782be579294e9","repo":"hibernate/hibernate-orm","slug":"attribute-attribute-is-annotated-fetch-for","errorCode":null,"errorMessage":"Attribute '${attribute}' is annotated '@Fetch' for graph '${graph}' with an unknown subgraph '${subgraph}'","messagePattern":"Attribute '(.+?)' is annotated '@Fetch' for graph '(.+?)' with an unknown subgraph '(.+?)'","errorType":"exception","errorClass":"AnnotationException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/boot/model/internal/NamedGraphCreatorJpa.java","lineNumber":156,"sourceCode":"\t\t\tString subgraphName,\n\t\t\tAttributeNodeImplementor<T,E,K> attributeNode,\n\t\t\tboolean isKeySubGraph,\n\t\t\tList<FetchGraphContribution> fetchContributions) {\n\t\tfor ( var namedSubgraph : namedEntityGraph.subgraphs() ) {\n\t\t\tif ( subgraphName.equals( namedSubgraph.name() ) ) {\n\t\t\t\tapplyNamedAttributeNodes( namedSubgraph.attributeNodes(), namedEntityGraph,\n\t\t\t\t\t\tcreateSubgraph( attributeNode, isKeySubGraph, namedSubgraph.type() ), subgraphName, fetchContributions );\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate void validateFetchContributions() {\n\t\tvalidateConflictingFetchContributions();\n\t\tfor ( var fetchContribution : fetchContributions ) {\n\t\t\tif ( fetchContribution.appliesTo( name ) ) {\n\t\t\t\tfor ( var subgraphName : fetchContribution.subgraphNames() ) {\n\t\t\t\t\tif ( !isNamedSubgraph( subgraphName ) && modelsContext == null ) {\n\t\t\t\t\t\tthrow new AnnotationException(\n\t\t\t\t\t\t\t\t\"Attribute '\" + fetchContribution.attributeName()\n\t\t\t\t\t\t\t\t\t\t+ \"' is annotated '@Fetch' for graph '\" + name\n\t\t\t\t\t\t\t\t\t\t+ \"' with an unknown subgraph '\" + subgraphName + \"'\" );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate void validateConflictingFetchContributions() {\n\t\tfor ( int i = 0; i < fetchContributions.size(); i++ ) {\n\t\t\tfinal var first = fetchContributions.get( i );\n\t\t\tif ( !first.appliesTo( name ) ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tfor ( int j = i + 1; j < fetchContributions.size(); j++ ) {\n\t\t\t\tfinal var second = fetchContributions.get( j );\n\t\t\t\tif ( sameFetchTarget( first, second ) ) {","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/boot/model/internal/NamedGraphCreatorJpa.java#L138-L174","documentation":"Error \"Attribute '${attribute}' is annotated '@Fetch' for graph '${graph}' with an unknown subgraph '${subgraph}'\" 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 subgraph name in @Fetch to a subgraph defined in the named entity graph."],"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"}