bumptech/glide · critical · IllegalStateException
Glide has been called recursively, this is probably an inter
Error message
Glide has been called recursively, this is probably an internal library error!
What it means
Thrown by Glide.checkAndInitializeGlide() when isInitializing is already true, i.e. Glide's initialization re-entered itself. During initializeGlide() some class loaded on that thread called Glide.get(context) again, which would otherwise recurse infinitely, so the library aborts instead of stack-overflowing.
Source
Thrown at library/src/main/java/com/bumptech/glide/Glide.java:161
getAnnotationGeneratedGlideModules(context.getApplicationContext());
synchronized (Glide.class) {
if (glide == null) {
checkAndInitializeGlide(context, annotationGeneratedModule);
}
}
}
return glide;
}
@GuardedBy("Glide.class")
@VisibleForTesting
static void checkAndInitializeGlide(
@NonNull Context context, @Nullable GeneratedAppGlideModule generatedAppGlideModule) {
// In the thread running initGlide(), one or more classes may call Glide.get(context).
// Without this check, those calls could trigger infinite recursion.
if (isInitializing) {
throw new IllegalStateException(
"Glide has been called recursively, this is probably an internal library error!");
}
isInitializing = true;
try {
initializeGlide(context, generatedAppGlideModule);
} finally {
isInitializing = false;
}
}
/**
* @deprecated Use {@link #init(Context, GlideBuilder)} to get a singleton compatible with Glide's
* generated API.
* <p>This method will be removed in a future version of Glide.
*/
@VisibleForTesting
@Deprecated
public static synchronized void init(Glide glide) {View on GitHub (pinned to eb14a895d8)
Solutions
- Audit any GlideModule/AppGlideModule hooks for calls to Glide.get(context) during registration and remove them; use the provided context/builder instead.
- Ensure custom ModelLoaders/decoders do not call back into Glide.get() at construction or registration time.
- Defer any Glide.get() usage until after initialization completes (e.g. on first real request).
- If you do not maintain a GlideModule, check for libraries that initialize Glide transitively and update them.
- Update Glide to the latest stable release; recursion guards have been refined across versions.
Example fix
// before
@GlideModule
class MyModule : AppGlideModule() {
override fun registerComponents(context: Context, glide: Glide, registry: Registry) {
val g = Glide.get(context) // triggers recursion during init
}
}
// after
@GlideModule
class MyModule : AppGlideModule() {
override fun registerComponents(context: Context, glide: Glide, registry: Registry) {
registry.append(...) // use the provided glide/registry; do not call Glide.get()
}
} Defensive patterns
Strategy: validation
Validate before calling
// Do not call Glide.get() during module registration/initialization.
@GlideModule
class MyModule : AppGlideModule() {
override fun registerComponents(context: Context, glide: Glide, registry: Registry) {
registry.append(MyModel::class.java, MyLoader.Factory()) // no Glide.get(context) here
}
} Prevention
- Never call Glide.get(context) inside GlideModule hooks or initializers.
- Defer Glide access until after initialization completes (first real request).
- Audit third-party libraries that might initialize Glide transitively.
When it happens
Trigger: While initializeGlide(context, module) is running, code on the same thread calls Glide.get(context) (or a path that does), finding isInitializing == true and throwing.
Common situations: A GlideModule / AppGlideModule registerComponents() or similar hook that tries to obtain the Glide singleton during initialization; a RequestListener, ModelLoader, or decoder that lazily calls Glide.get() while being registered; a ContentProvider-based initializer that races with explicit Glide.get(); an internal library bug.
Related errors
- GeneratedAppGlideModuleImpl is implemented incorrectly. If y
- Cannot register already registered manager
- Cannot unregister not yet registered manager
- Log level must be one of Log.VERBOSE, Log.DEBUG, Log.INFO, L
- Failed to find result encoder for resource class: {}, you ma
AI-assisted analysis of bumptech/glide@eb14a895d8 (2026-08-14).
Data as JSON: /api/errors/7eda437f9fe35dbc.
Report an issue: GitHub.