bumptech/glide · error · RuntimeException
Expected instanceof GlideModule, but found: {module}
Error message
Expected instanceof GlideModule, but found: {module} What it means
Thrown by ManifestParser.parseModule after a class named in AndroidManifest meta-data was loaded and instantiated via reflection but does not implement com.bumptech.glide.module.GlideModule. The parser needs the GlideModule contract (registerComponents / applyOptions) to wire in custom behavior.
Source
Thrown at library/src/main/java/com/bumptech/glide/module/ManifestParser.java:99
throw new IllegalArgumentException("Unable to find GlideModule implementation", e);
}
Object module = null;
try {
module = clazz.getDeclaredConstructor().newInstance();
// These can't be combined until API minimum is 19.
} catch (InstantiationException e) {
throwInstantiateGlideModuleException(clazz, e);
} catch (IllegalAccessException e) {
throwInstantiateGlideModuleException(clazz, e);
} catch (NoSuchMethodException e) {
throwInstantiateGlideModuleException(clazz, e);
} catch (InvocationTargetException e) {
throwInstantiateGlideModuleException(clazz, e);
}
if (!(module instanceof GlideModule)) {
throw new RuntimeException("Expected instanceof GlideModule, but found: " + module);
}
return (GlideModule) module;
}
private static void throwInstantiateGlideModuleException(Class<?> clazz, Exception e) {
throw new RuntimeException("Unable to instantiate GlideModule implementation for " + clazz, e);
}
}
View on GitHub (pinned to eb14a895d8)
Solutions
- Make the registered class implement (or extend a base that implements) com.bumptech.glide.module.GlideModule
- Migrate to the modern @GlideModule + AppGlideModule annotation-processor API and delete the manifest entry
- Remove the stale meta-data entry if the class is not meant to be a Glide module
- Verify the class has a public no-arg constructor and the correct inheritance after library upgrades
Example fix
// before
<meta-data android:name="com.example.ConfigHolder" android:value="GlideModule"/>
// ConfigHolder is a plain object, not a GlideModule
// after
class MyGlideModule : GlideModule {
override fun applyOptions(context: Context, builder: GlideBuilder) { /* ... */ }
override fun registerComponents(context: Context, glide: Glide, registry: Registry) { /* ... */ }
} Defensive patterns
Strategy: type-guard
Validate before calling
val module: Any = clazz.getDeclaredConstructor().newInstance()
require(module is GlideModule) { "${clazz.name} is not a GlideModule" } Type guard
fun isGlideModule(clazz: Class<*>): Boolean = com.bumptech.glide.module.GlideModule::class.java.isAssignableFrom(clazz)
Prevention
- Ensure every class registered under android:value="GlideModule" implements GlideModule
- Prefer the annotation-processor @GlideModule API which enforces the type at compile time
- Add a CI check that scans AndroidManifest meta-data entries against the source set
When it happens
Trigger: Registering a plain class, a data holder, or a class implementing a different interface under android:value="GlideModule" in the manifest. The class loads and constructs fine, but fails the instanceof GlideModule check at ManifestParser.java:99.
Common situations: Copy-paste of a meta-data entry with the wrong class; a module class that extends a base class which no longer implements GlideModule after a library update; using an AppGlideModule (the new API) name in the old manifest meta-data path.
Related errors
- Unable to find GlideModule implementation
- Unable to instantiate GlideModule implementation for {clazz}
- You cannot start a load on a fragment before it is attached
- sizeMultiplier must be between 0 and 1
- You cannot auto lock an already locked options object, try c
AI-assisted analysis of bumptech/glide@eb14a895d8 (2026-08-14).
Data as JSON: /api/errors/5284d38a11c0d033.
Report an issue: GitHub.