{"record":{"id":"441072b70464b8ce","repo":"bumptech/glide","slug":"failed-to-find-image-header-parser","errorCode":null,"errorMessage":"Failed to find image header parser.","messagePattern":"Failed to find image header parser\\.","errorType":"exception","errorClass":"NoImageHeaderParserException","httpStatus":null,"severity":"error","filePath":"library/src/main/java/com/bumptech/glide/Registry.java","lineNumber":602,"sourceCode":"    }\n    throw new NoSourceEncoderAvailableException(data.getClass());\n  }\n\n  @NonNull\n  public <X> DataRewinder<X> getRewinder(@NonNull X data) {\n    return dataRewinderRegistry.build(data);\n  }\n\n  @NonNull\n  public <Model> List<ModelLoader<Model, ?>> getModelLoaders(@NonNull Model model) {\n    return modelLoaderRegistry.getModelLoaders(model);\n  }\n\n  @NonNull\n  public List<ImageHeaderParser> getImageHeaderParsers() {\n    List<ImageHeaderParser> result = imageHeaderParserRegistry.getParsers();\n    if (result.isEmpty()) {\n      throw new NoImageHeaderParserException();\n    }\n    return result;\n  }\n\n  /**\n   * Thrown when no {@link com.bumptech.glide.load.model.ModelLoader} is registered for a given\n   * model class.\n   */\n  // Never serialized by Glide.\n  @SuppressWarnings(\"serial\")\n  public static class NoModelLoaderAvailableException extends MissingComponentException {\n\n    public NoModelLoaderAvailableException(@NonNull Object model) {\n      super(\"Failed to find any ModelLoaders registered for model class: \" + model.getClass());\n    }\n\n    public <M> NoModelLoaderAvailableException(\n        @NonNull M model, @NonNull List<ModelLoader<M, ?>> matchingButNotHandlingModelLoaders) {","sourceCodeStart":584,"sourceCodeEnd":620,"githubUrl":"https://github.com/bumptech/glide/blob/eb14a895d8f866e6a08c3e19d50ea3bd2c12c20a/library/src/main/java/com/bumptech/glide/Registry.java#L584-L620","documentation":"Thrown (as NoImageHeaderParserException) by Registry.getImageHeaderParsers() when the image-header-parser registry is empty. Glide needs at least one ImageHeaderParser to inspect image headers (format, orientation, dimensions) during decoding.","triggerScenarios":"getImageHeaderParsers() calls imageHeaderParserRegistry.getParsers(); if the list is empty, NoImageHeaderParserException is thrown.","commonSituations":"A trimmed Glide setup where the default header parsers were not registered (e.g. constructing Glide via GlideBuilder without registering defaults); a custom Registry/Initializer that cleared parsers; aggressive R8/ProGuard stripping; missing glide-gif-decoder / default decoder integrations; image loading attempted before full Glide initialization.","solutions":["Ensure Glide is initialized through the normal path (Glide.init / GeneratedAppGlideModule) which registers default ImageHeaderParsers.","If building a custom Registry, register at least one ImageHeaderParser (e.g. DefaultImageHeaderParser) via registry.append(...).","Keep the glide default integration artifacts (gif decoder, etc.) on the classpath.","Add ProGuard/R8 keep rules so parsers are not stripped, or disable shrinking for Glide's registry classes.","Avoid calling image-load APIs before Glide initialization completes."],"exampleFix":"// before (custom Registry with no header parser)\nval glide = GlideBuilder()\n  .setRegistry(Registry()) // empty -> NoImageHeaderParserException\n  .build(context)\n\n// after\nval registry = Registry().apply {\n  register(InputStream::class.java, DefaultImageHeaderParser())\n  // ... plus decoders/encoders\n}\nval glide = GlideBuilder().setRegistry(registry).build(context)","handlingStrategy":"validation","validationCode":"// Ensure default header parsers are registered (normal init path does this).\n// In a custom Registry, register at least one parser:\nregistry.register(InputStream::class.java, DefaultImageHeaderParser())\n\n// Optionally guard before decoding an image.\nfun canParseHeaders(glide: Glide): Boolean =\n  try { glide.registry.imageHeaderParsers.isNotEmpty() } catch (e: NoImageHeaderParserException) { false }","typeGuard":null,"tryCatchPattern":"try {\n  glide.registry.imageHeaderParsers\n} catch (e: NoImageHeaderParserException) {\n  // register a parser or report misconfiguration before attempting loads\n}","preventionTips":["Initialize Glide through the standard path so default parsers register.","In custom Registries, always append an ImageHeaderParser.","Keep default decoder integrations (gif decoder) and ProGuard keep rules intact."],"tags":["glide-core","registry","image-header-parser","decoder","configuration","runtime"],"backgroundTag":null,"analyzedSha":"eb14a895d8f866e6a08c3e19d50ea3bd2c12c20a","analyzedAt":"2026-08-14T01:43:54.821Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}