bumptech/glide · error · IllegalArgumentException
MultiTransformation must contain at least one Transformation
Error message
MultiTransformation must contain at least one Transformation
What it means
MultiTransformation applies a chain of Transformation objects to a resource in iteration order. The varargs constructor requires at least one Transformation; an empty argument list produces a useless object that would skip all transformation logic. The IllegalArgumentException is thrown when transformations.length is 0.
Source
Thrown at library/src/main/java/com/bumptech/glide/load/MultiTransformation.java:22
import androidx.annotation.NonNull;
import com.bumptech.glide.load.engine.Resource;
import java.security.MessageDigest;
import java.util.Arrays;
import java.util.Collection;
/**
* A transformation that applies one or more transformations in iteration order to a resource.
*
* @param <T> The type of {@link com.bumptech.glide.load.engine.Resource} that will be transformed.
*/
public class MultiTransformation<T> implements Transformation<T> {
private final Collection<? extends Transformation<T>> transformations;
@SafeVarargs
@SuppressWarnings("varargs")
public MultiTransformation(@NonNull Transformation<T>... transformations) {
if (transformations.length == 0) {
throw new IllegalArgumentException(
"MultiTransformation must contain at least one Transformation");
}
this.transformations = Arrays.asList(transformations);
}
public MultiTransformation(@NonNull Collection<? extends Transformation<T>> transformationList) {
if (transformationList.isEmpty()) {
throw new IllegalArgumentException(
"MultiTransformation must contain at least one Transformation");
}
this.transformations = transformationList;
}
@NonNull
@Override
public Resource<T> transform(
@NonNull Context context, @NonNull Resource<T> resource, int outWidth, int outHeight) {
Resource<T> previous = resource;View on GitHub (pinned to eb14a895d8)
Solutions
- Check that the transformations array is non-empty before constructing MultiTransformation
- If the collection might be empty, skip applying MultiTransformation entirely or provide a default Transformation
- Use the Collection overload and validate before constructing
Example fix
// before
MultiTransformation<Bitmap> multi = new MultiTransformation<>(transforms.toArray(new Transformation[0]));
// after
if (transforms.isEmpty()) {
// skip or use single transform
} else {
MultiTransformation<Bitmap> multi = new MultiTransformation<>(transforms.toArray(new Transformation[0]));
} Defensive patterns
Strategy: validation
Validate before calling
List<Transformation<Bitmap>> transforms = collectTransforms();
if (!transforms.isEmpty()) {
Transformation<Bitmap>[] arr = transforms.toArray(new Transformation[0]);
options.transform(new MultiTransformation<>(arr));
} else {
// no transforms to apply — skip MultiTransformation
} Prevention
- Check that your transformations array is non-empty before constructing MultiTransformation
- Default to a single CenterCrop or similar when no user-selected transforms exist
- Prefer the Collection constructor for dynamic transform lists
When it happens
Trigger: Calling new MultiTransformation<>() with no arguments. Spreading a programmatically-built array of transformations that happens to be empty. Passing a varargs collection that was filtered down to zero elements.
Common situations: Dynamic transformation pipelines built from user-selected options where no option is selected. Code that collects transformations from a list and passes them via varargs without checking emptiness.
Related errors
- sizeMultiplier must be between 0 and 1
- Cannot add invalid orientation: {orientation}
- Cannot apply transformation on width: {outWidth} or height:
- sizeMultiplier must be between 0 and 1
- File unsuitable for memory mapping
AI-assisted analysis of bumptech/glide@eb14a895d8 (2026-08-14).
Data as JSON: /api/errors/497bf14787c002a6.
Report an issue: GitHub.