bumptech/glide · error · IllegalArgumentException
sizeMultiplier must be between 0 and 1
Error message
sizeMultiplier must be between 0 and 1
What it means
Thrown by BaseRequestOptions.sizeMultiplier(float) when the supplied value is less than 0f or greater than 1f. sizeMultiplier scales the Target's dimensions for the decode, so an out-of-range value is meaningless and rejected. The @FloatRange annotation gives static-analysis (lint/IDE) the same bound.
Source
Thrown at library/src/main/java/com/bumptech/glide/request/BaseRequestOptions.java:124
/**
* Applies a multiplier to the {@link com.bumptech.glide.request.target.Target}'s size before
* loading the resource. Useful for loading thumbnails or trying to avoid loading huge resources
* (particularly {@link Bitmap}s on devices with overly dense screens.
*
* @param sizeMultiplier The multiplier to apply to the {@link
* com.bumptech.glide.request.target.Target}'s dimensions when loading the resource.
* @return This request builder.
*/
@NonNull
@CheckResult
public T sizeMultiplier(@FloatRange(from = 0, to = 1) float sizeMultiplier) {
if (isAutoCloneEnabled) {
return clone().sizeMultiplier(sizeMultiplier);
}
if (sizeMultiplier < 0f || sizeMultiplier > 1f) {
throw new IllegalArgumentException("sizeMultiplier must be between 0 and 1");
}
this.sizeMultiplier = sizeMultiplier;
fields |= SIZE_MULTIPLIER;
return selfOrThrowIfLocked();
}
/**
* If set to {@code true}, uses a cached unlimited {@link java.util.concurrent.Executor} to run
* the request.
*
* <p>This method should <em>ONLY</em> be used when a Glide load is started recursively on one of
* Glide's threads as part of another request. Using this method in other scenarios can lead to
* excessive memory usage and OOMs and/or a significant decrease in performance across an
* application.
*
* <p>If both this method and {@link #useAnimationPool(boolean)} are set, this method will be
* preferred and {@link #useAnimationPool(boolean)} will be ignored.View on GitHub (pinned to eb14a895d8)
Solutions
- Pass a normalized fraction in [0f, 1f]: divide percentages by 100
- If you need larger-than-target output, use .override(width, height) or .override(Target.SIZE_ORIGINAL) instead of sizeMultiplier
- Add a runtime clamp: sizeMultiplier.coerceIn(0f, 1f) in Kotlin or Math.max(0f, Math.min(1f, v)) in Java
- Enable the @FloatRange lint check in Android Studio to catch the value at edit time
Example fix
// before val pct = seekBar.progress // 0..100 Glide.with(view).load(url).sizeMultiplier(pct.toFloat()).into(imageView) // after Glide.with(view).load(url).sizeMultiplier(pct / 100f).into(imageView)
Defensive patterns
Strategy: validation
Validate before calling
fun safeMultiplier(pct: Int): Float = (pct / 100f).coerceIn(0f, 1f) // then: options.sizeMultiplier(safeMultiplier(seekBar.progress))
Prevention
- Normalize percentages to [0,1] before calling sizeMultiplier
- Use @FloatRange(from=0,to=1) on your own helper params to get lint coverage
- For larger-than-target output use override(width,height), not sizeMultiplier
When it happens
Trigger: Calling .sizeMultiplier(x) with x < 0 or x > 1 on a RequestOptions/RequestBuilder. Common with computed values such as percentage / 100 forgotten, or passing a dimension pixel value directly.
Common situations: Computing a multiplier from a percentage but forgetting to divide by 100 (e.g. .sizeMultiplier(75f) instead of .sizeMultiplier(0.75f)); reading a value from a slider/SeekBar (0..100) without normalization; copy-paste from code that used absolute pixels.
Related errors
- Multiplier must be >= 0
- You cannot auto lock an already locked options object, try c
- You cannot modify locked T, consider clone()
- File unsuitable for memory mapping
- Must not be null or empty
AI-assisted analysis of bumptech/glide@eb14a895d8 (2026-08-14).
Data as JSON: /api/errors/f798738867f65f18.
Report an issue: GitHub.