hibernate/hibernate-orm · error · IllegalArgumentException
Graph semantic cannot be null
Error message
Graph semantic cannot be null
What it means
Error "Graph semantic cannot be null" thrown in hibernate/hibernate-orm.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/engine/spi/EffectiveEntityGraph.java:85
public @Nullable GraphSemantic getSemantic() {
return semantic;
}
@Override
public @Nullable RootGraphImplementor<?> getGraph() {
return graph;
}
/**
* Apply the graph and semantic. The semantic is required. The graph
* may be null, but that should generally be considered mis-use.
*
* @throws IllegalArgumentException Thrown if the semantic is null
* @throws IllegalStateException If previous state is still available (hasn't been cleared).
*/
public void applyGraph(RootGraphImplementor<?> graph, GraphSemantic semantic) {
if ( semantic == null ) {
throw new IllegalArgumentException( "Graph semantic cannot be null" );
}
verifyWriteability();
LOG.tracef( "Setting effective graph state [%s] : %s", semantic.name(), graph );
this.semantic = semantic;
this.graph = graph;
}
private void verifyWriteability() {
if ( ! allowOverwrite ) {
if ( semantic != null ) {
throw new IllegalStateException( "Cannot overwrite existing state, should clear previous state first" );
}
}
}
/**
* Apply a graph and semantic based on configuration properties or hints
* based on {@link GraphSemantic#getJakartaHintName()} for {@link GraphSemantic#LOAD} orView on GitHub (pinned to fad1729dce)
Solutions
- Pass an explicit GraphSemantic (FETCHGRAPH or LOADGRAPH) instead of null
- Use the overloaded method that infers the semantic when only a graph is given
When it happens
Trigger: Thrown at hibernate-core/src/main/java/org/hibernate/engine/spi/EffectiveEntityGraph.java:85 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/f20ef807bcac46cd.
Report an issue: GitHub.