{"record":{"id":"7eda437f9fe35dbc","repo":"bumptech/glide","slug":"glide-has-been-called-recursively-this-is-probabl","errorCode":null,"errorMessage":"Glide has been called recursively, this is probably an internal library error!","messagePattern":"Glide has been called recursively, this is probably an internal library error!","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"critical","filePath":"library/src/main/java/com/bumptech/glide/Glide.java","lineNumber":161,"sourceCode":"          getAnnotationGeneratedGlideModules(context.getApplicationContext());\n      synchronized (Glide.class) {\n        if (glide == null) {\n          checkAndInitializeGlide(context, annotationGeneratedModule);\n        }\n      }\n    }\n\n    return glide;\n  }\n\n  @GuardedBy(\"Glide.class\")\n  @VisibleForTesting\n  static void checkAndInitializeGlide(\n      @NonNull Context context, @Nullable GeneratedAppGlideModule generatedAppGlideModule) {\n    // In the thread running initGlide(), one or more classes may call Glide.get(context).\n    // Without this check, those calls could trigger infinite recursion.\n    if (isInitializing) {\n      throw new IllegalStateException(\n          \"Glide has been called recursively, this is probably an internal library error!\");\n    }\n    isInitializing = true;\n    try {\n      initializeGlide(context, generatedAppGlideModule);\n    } finally {\n      isInitializing = false;\n    }\n  }\n\n  /**\n   * @deprecated Use {@link #init(Context, GlideBuilder)} to get a singleton compatible with Glide's\n   *     generated API.\n   *     <p>This method will be removed in a future version of Glide.\n   */\n  @VisibleForTesting\n  @Deprecated\n  public static synchronized void init(Glide glide) {","sourceCodeStart":143,"sourceCodeEnd":179,"githubUrl":"https://github.com/bumptech/glide/blob/eb14a895d8f866e6a08c3e19d50ea3bd2c12c20a/library/src/main/java/com/bumptech/glide/Glide.java#L143-L179","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\n@GlideModule\nclass MyModule : AppGlideModule() {\n  override fun registerComponents(context: Context, glide: Glide, registry: Registry) {\n    val g = Glide.get(context) // triggers recursion during init\n  }\n}\n\n// after\n@GlideModule\nclass MyModule : AppGlideModule() {\n  override fun registerComponents(context: Context, glide: Glide, registry: Registry) {\n    registry.append(...) // use the provided glide/registry; do not call Glide.get()\n  }\n}","handlingStrategy":"validation","validationCode":"// Do not call Glide.get() during module registration/initialization.\n@GlideModule\nclass MyModule : AppGlideModule() {\n  override fun registerComponents(context: Context, glide: Glide, registry: Registry) {\n    registry.append(MyModel::class.java, MyLoader.Factory()) // no Glide.get(context) here\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["glide-core","initialization","recursion","runtime","glidemodule"],"backgroundTag":null,"analyzedSha":"eb14a895d8f866e6a08c3e19d50ea3bd2c12c20a","analyzedAt":"2026-08-14T01:43:54.821Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}