bumptech/glide · error · IllegalArgumentException

Requested to override an existing method in BaseRequestOptio

Error message

Requested to override an existing method in BaseRequestOptions, but no such method was found. Offending method: {}

What it means

The mirror case of error 10: you declared `override = OVERRIDE_EXTEND` or `OVERRIDE_REPLACE` on a @GlideOption method, but no method with the same name and argument types exists in BaseRequestOptions, so there is nothing to extend or replace. The processor refuses to generate super-call/dispatch code against a non-existent method.

Source

Thrown at annotation/compiler/src/main/java/com/bumptech/glide/annotation/compiler/GlideExtensionValidator.java:160

    }
    return typeMirror instanceof DeclaredType declaredType
        && declaredType.asElement() instanceof TypeElement typeElement
        && typeElement
            .getQualifiedName()
            .contentEquals("com.bumptech.glide.request.BaseRequestOptions");
  }

  private void validateGlideOptionOverride(ExecutableElement element) {
    int overrideType = processorUtil.getOverrideType(element);
    boolean isOverridingBaseRequestOptionsMethod = isMethodInBaseRequestOptions(element);
    if (isOverridingBaseRequestOptionsMethod && overrideType == GlideOption.OVERRIDE_NONE) {
      throw new IllegalArgumentException(
          "Accidentally attempting to override a method in"
              + " BaseRequestOptions. Add an 'override' value in the @GlideOption annotation"
              + " if this is intentional. Offending method: "
              + getQualifiedMethodName(element));
    } else if (!isOverridingBaseRequestOptionsMethod && overrideType != GlideOption.OVERRIDE_NONE) {
      throw new IllegalArgumentException(
          "Requested to override an existing method in"
              + " BaseRequestOptions, but no such method was found. Offending method: "
              + getQualifiedMethodName(element));
    }
  }

  private boolean isMethodInBaseRequestOptions(ExecutableElement toFind) {
    // toFind is a method in a GlideExtension whose first argument is a BaseRequestOptions<?> type.
    // Since we're comparing against methods in BaseRequestOptions itself, we need to drop that
    // first type.
    TypeElement requestOptionsType =
        processingEnvironment
            .getElementUtils()
            .getTypeElement(RequestOptionsGenerator.BASE_REQUEST_OPTIONS_QUALIFIED_NAME);
    List<TypeMirror> toFindParameterTypes =
        getComparableParameterTypes(toFind, /* skipFirst= */ true);
    String toFindSimpleName = toFind.getSimpleName().toString();
    for (Element element : requestOptionsType.getEnclosedElements()) {

View on GitHub (pinned to eb14a895d8)

Solutions

  1. If the method is genuinely new (no matching built-in), drop `override` so it defaults to OVERRIDE_NONE.
  2. If you intended to override, rename your method (and align trailing parameters) to match a real BaseRequestOptions method like `placeholder`, `override`, or `format`.

Example fix

// before
@GlideOption(override = GlideOption.OVERRIDE_EXTEND)
public static RequestOptions myAvatar(RequestOptions options, int resId) {
  return options.placeholder(resId);
}

// after (no matching base method -> use OVERRIDE_NONE)
@GlideOption
public static RequestOptions myAvatar(RequestOptions options, int resId) {
  return options.placeholder(resId);
}
Defensive patterns

Strategy: validation

Validate before calling

@Test void glideOptionOverridesTargetExistingMethod() throws Exception {
  java.util.Set<String> base = new java.util.HashSet<>();
  for (java.lang.reflect.Method m : com.bumptech.glide.request.BaseRequestOptions.class.getDeclaredMethods()) base.add(m.getName());
  for (java.lang.reflect.Method m : MyGlideExtension.class.getDeclaredMethods()) {
    com.bumptech.glide.annotation.GlideOption o = m.getAnnotation(com.bumptech.glide.annotation.GlideOption.class);
    if (o != null && o.override() != com.bumptech.glide.annotation.GlideOption.OVERRIDE_NONE) {
      assertTrue("@GlideOption(" + m + ") declares override but no base method exists", base.contains(m.getName()));
    }
  }
}

Prevention

When it happens

Trigger: GlideExtensionValidator.validateGlideOptionOverride throws in the `else if (!isOverridingBaseRequestOptionsMethod && overrideType != GlideOption.OVERRIDE_NONE)` branch. Hit by annotating a uniquely-named method (e.g. `@GlideOption(override = OVERRIDE_EXTEND) static RequestOptions myAvatar(RequestOptions o, ...)`) — there is no `myAvatar` in BaseRequestOptions.

Common situations: Copy-pasting an `override = OVERRIDE_EXTEND` annotation onto a fresh method; refactoring a method name so it no longer matches the BaseRequestOptions method you originally overrode; changing the parameter list so the signature no longer matches.

Related errors


AI-assisted analysis of bumptech/glide@eb14a895d8 (2026-08-14). Data as JSON: /api/errors/1e3d4afdd34e19a3. Report an issue: GitHub.