{"record":{"id":"f798738867f65f18","repo":"bumptech/glide","slug":"sizemultiplier-must-be-between-0-and-1-f79873","errorCode":null,"errorMessage":"sizeMultiplier must be between 0 and 1","messagePattern":"sizeMultiplier must be between 0 and 1","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"library/src/main/java/com/bumptech/glide/request/BaseRequestOptions.java","lineNumber":124,"sourceCode":"\n  /**\n   * Applies a multiplier to the {@link com.bumptech.glide.request.target.Target}'s size before\n   * loading the resource. Useful for loading thumbnails or trying to avoid loading huge resources\n   * (particularly {@link Bitmap}s on devices with overly dense screens.\n   *\n   * @param sizeMultiplier The multiplier to apply to the {@link\n   *     com.bumptech.glide.request.target.Target}'s dimensions when loading the resource.\n   * @return This request builder.\n   */\n  @NonNull\n  @CheckResult\n  public T sizeMultiplier(@FloatRange(from = 0, to = 1) float sizeMultiplier) {\n    if (isAutoCloneEnabled) {\n      return clone().sizeMultiplier(sizeMultiplier);\n    }\n\n    if (sizeMultiplier < 0f || sizeMultiplier > 1f) {\n      throw new IllegalArgumentException(\"sizeMultiplier must be between 0 and 1\");\n    }\n    this.sizeMultiplier = sizeMultiplier;\n    fields |= SIZE_MULTIPLIER;\n\n    return selfOrThrowIfLocked();\n  }\n\n  /**\n   * If set to {@code true}, uses a cached unlimited {@link java.util.concurrent.Executor} to run\n   * the request.\n   *\n   * <p>This method should <em>ONLY</em> be used when a Glide load is started recursively on one of\n   * Glide's threads as part of another request. Using this method in other scenarios can lead to\n   * excessive memory usage and OOMs and/or a significant decrease in performance across an\n   * application.\n   *\n   * <p>If both this method and {@link #useAnimationPool(boolean)} are set, this method will be\n   * preferred and {@link #useAnimationPool(boolean)} will be ignored.","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/bumptech/glide/blob/eb14a895d8f866e6a08c3e19d50ea3bd2c12c20a/library/src/main/java/com/bumptech/glide/request/BaseRequestOptions.java#L106-L142","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nval pct = seekBar.progress // 0..100\nGlide.with(view).load(url).sizeMultiplier(pct.toFloat()).into(imageView)\n\n// after\nGlide.with(view).load(url).sizeMultiplier(pct / 100f).into(imageView)","handlingStrategy":"validation","validationCode":"fun safeMultiplier(pct: Int): Float = (pct / 100f).coerceIn(0f, 1f)\n// then: options.sizeMultiplier(safeMultiplier(seekBar.progress))","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["android","glide","validation","range-check","request-options"],"backgroundTag":null,"analyzedSha":"eb14a895d8f866e6a08c3e19d50ea3bd2c12c20a","analyzedAt":"2026-08-14T01:43:54.821Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}