didi/DoKit · error · IllegalArgumentException
Transformation list must not be null.
Error message
Transformation list must not be null.
What it means
Thrown by the list overload of Request.Builder.transform(List<? extends Transformation>) when the list argument is null. Picasso rejects the null list up front (the per-element transform(Transformation) overload separately validates each entry).
Source
Thrown at Android/dokit/src/main/java/com/didichuxing/doraemonkit/picasso/Request.java:446
}
if (transformation.key() == null) {
throw new IllegalArgumentException("Transformation key must not be null.");
}
if (transformations == null) {
transformations = new ArrayList<com.didichuxing.doraemonkit.picasso.Transformation>(2);
}
transformations.add(transformation);
return this;
}
/**
* Add a list of custom transformations to be applied to the image.
* <p>
* Custom transformations will always be run after the built-in transformations.
*/
public Builder transform(List<? extends Transformation> transformations) {
if (transformations == null) {
throw new IllegalArgumentException("Transformation list must not be null.");
}
for (int i = 0, size = transformations.size(); i < size; i++) {
transform(transformations.get(i));
}
return this;
}
/** Create the immutable {@link Request} object. */
public Request build() {
if (centerInside && centerCrop) {
throw new IllegalStateException("Center crop and center inside can not be used together.");
}
if (centerCrop && (targetWidth == 0 && targetHeight == 0)) {
throw new IllegalStateException(
"Center crop requires calling resize with positive width and height.");
}
if (centerInside && (targetWidth == 0 && targetHeight == 0)) {
throw new IllegalStateException(View on GitHub (pinned to 626827cddb)
Solutions
- Return Collections.emptyList() instead of null from transformation-builder helpers.
- Null-check or default the list before calling: transform(list != null ? list : Collections.emptyList()).
- In Kotlin, make transformation lists non-null (List<Transformation> instead of List<Transformation>?).
Example fix
// before List<Transformation> ts = settings.enabled() ? getTransforms() : null; builder.transform(ts); // after List<Transformation> ts = settings.enabled() ? getTransforms() : Collections.emptyList(); builder.transform(ts);
Defensive patterns
Strategy: type-guard
Validate before calling
List<Transformation> safe = transformations != null ? transformations : Collections.<Transformation>emptyList(); builder.transform(safe);
Type guard
static List<Transformation> nonNullTransforms(List<Transformation> list) {
return list != null ? list : Collections.<Transformation>emptyList();
} Prevention
- Helpers should return empty lists, never null, for 'no transformations'.
- In Kotlin use non-null List<Transformation> types.
When it happens
Trigger: Calling transform((List<Transformation>) null), or transform(buildTransforms()) where buildTransforms() returned null.
Common situations: A helper that returns null instead of an empty list when no transformations apply; Java varargs passing a null array; Kotlin code passing a nullable List<Transformation>! from Java interop.
Related errors
AI-assisted analysis of didi/DoKit@626827cddb (2026-08-14).
Data as JSON: /api/errors/db32e80348fdb3d2.
Report an issue: GitHub.