bumptech/glide · error · IllegalArgumentException
Expected non-empty parameters for: {}
Error message
Expected non-empty parameters for: {} What it means
Thrown when generating a static helper for a @GlideOption extension method that declares zero parameters. Glide requires the extension's instance method to take at least one parameter (the RequestOptions/BaseRequestOptions to operate on), which the generator strips before producing the public static method.
Source
Thrown at annotation/compiler/src/main/java/com/bumptech/glide/annotation/compiler/RequestOptionsGenerator.java:387
}
boolean memoize = memoizeStaticMethodFromAnnotation(instanceMethod);
//noinspection ResultOfMethodCallIgnored
Preconditions.checkNotNull(staticMethodName);
MethodSpec.Builder methodSpecBuilder =
MethodSpec.methodBuilder(staticMethodName)
.addModifiers(Modifier.PUBLIC, Modifier.STATIC)
.addJavadoc(processorUtil.generateSeeMethodJavadoc(instanceMethod))
.varargs(instanceMethod.isVarArgs())
.returns(glideOptionsName);
List<? extends VariableElement> parameters = instanceMethod.getParameters();
// Always remove the first parameter because it's always RequestOptions in extensions. The
// actual method we want to generate will pass the RequestOptions in to the extension method,
// but should not itself require a RequestOptions object to be passed in.
if (parameters.isEmpty()) {
throw new IllegalArgumentException("Expected non-empty parameters for: " + instanceMethod);
}
// Remove is not supported.
parameters = parameters.subList(1, parameters.size());
StringBuilder createNewOptionAndCall =
createNewOptionAndCall(
memoize, methodSpecBuilder, "new $T().$L(", processorUtil.getParameters(parameters));
FieldSpec requiredStaticField = null;
if (memoize) {
// Generates code that looks like:
// if (GlideOptions.<methodName> == null) {
// GlideOptions.<methodName> = new GlideOptions().<methodName>().autoClone()
// }
// Mix in an incrementing unique id to handle method overloading.
String staticVariableName = staticMethodName + nextFieldId++;
requiredStaticField =View on GitHub (pinned to eb14a895d8)
Solutions
- Add the required BaseRequestOptions/RequestOptions first parameter to the @GlideOption method.
- Provide any additional configuration parameters after the options parameter.
- Return the modified options object from the method (see error 22).
- Rebuild to regenerate the static helper.
Example fix
// before
@GlideOption
fun myOption(): RequestOptions // no parameters
// after
@GlideOption
fun myOption(options: RequestOptions): RequestOptions {
return options.format(DecodeFormat.RGB_565)
} Defensive patterns
Strategy: validation
Validate before calling
// @GlideOption methods require at least the RequestOptions parameter.
@GlideOption
fun myOption(options: RequestOptions, radius: Int): RequestOptions {
return options.transform(RoundedCorners(radius))
} Prevention
- Always include the BaseRequestOptions first parameter in @GlideOption methods.
- Validate extension method signatures against the current Glide extension contract.
When it happens
Trigger: generateStaticMethodEquivalentForRequestOptionsStaticMethod() reads instanceMethod.getParameters(); if the list is empty the guard at line 387 fires, because there is no RequestOptions parameter to remove.
Common situations: Declaring a @GlideOption method with no arguments at all; mis-copying the extension method signature so the RequestOptions parameter is missing; following an outdated signature example.
Related errors
- The {} method annotated with @GlideOption in the {} @GlideEx
- Failed to find value for: {} from mirrors: {}
- Unresolved class type in annotation: {}
- Unrecognized static method name: {}
- RequestOptionsExtensions must be public, including: {}
AI-assisted analysis of bumptech/glide@eb14a895d8 (2026-08-14).
Data as JSON: /api/errors/7b7a322c5ac20a54.
Report an issue: GitHub.