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

  1. Check that the transformations array is non-empty before constructing MultiTransformation
  2. If the collection might be empty, skip applying MultiTransformation entirely or provide a default Transformation
  3. 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

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


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