didi/DoKit · error · IllegalArgumentException
Executor service must not be null.
Error message
Executor service must not be null.
What it means
DokitPicasso.Builder.executor() throws IllegalArgumentException when passed a null ExecutorService. Picasso requires a non-null executor to run background image loads. The null check is a fail-fast guard on builder configuration.
Source
Thrown at Android/dokit/src/main/java/com/didichuxing/doraemonkit/picasso/DokitPicasso.java:738
public Builder downloader(Downloader downloader) {
if (downloader == null) {
throw new IllegalArgumentException("Downloader must not be null.");
}
if (this.downloader != null) {
throw new IllegalStateException("Downloader already set.");
}
this.downloader = downloader;
return this;
}
/**
* Specify the executor service for loading images in the background.
* <p>
* Note: Calling {@link DokitPicasso#shutdown() shutdown()} will not shutdown supplied executors.
*/
public Builder executor(ExecutorService executorService) {
if (executorService == null) {
throw new IllegalArgumentException("Executor service must not be null.");
}
if (this.service != null) {
throw new IllegalStateException("Executor service already set.");
}
this.service = executorService;
return this;
}
/** Specify the memory cache used for the most recent images. */
public Builder memoryCache(Cache memoryCache) {
if (memoryCache == null) {
throw new IllegalArgumentException("Memory cache must not be null.");
}
if (this.cache != null) {
throw new IllegalStateException("Memory cache already set.");
}
this.cache = memoryCache;
return this;View on GitHub (pinned to 626827cddb)
Solutions
- Pass a non-null ExecutorService, e.g. Executors.newFixedThreadPool(n)
- If the executor variable may be null, guard: only call executor() when the value is non-null
- Fix the upstream provider (DI module/factory) so it returns a valid executor
Example fix
// before builder.executor(null); // IllegalArgumentException // after builder.executor(Executors.newFixedThreadPool(4));
Defensive patterns
Strategy: validation
Validate before calling
ExecutorService executor = provider.executor();
if (executor != null) { builder.executor(executor); } // or fail loudly at provider level Prevention
- Assert non-null on DI-provided components at graph construction time
- Avoid passing nullable executor variables; create the executor inline
When it happens
Trigger: Calling builder.executor(null), often from a field or factory method that returned null (e.g. a DI-provided executor that was not initialized).
Common situations: Passing an executor obtained from a dependency container that has not been set up; test code that stubs the executor as null; conditional code that builds the executor only in some branches.
Related errors
- Memory cache must not be null.
- Listener must not be null.
- Transformer must not be null.
- RequestHandler must not be null.
- Downloader already set.
AI-assisted analysis of didi/DoKit@626827cddb (2026-08-14).
Data as JSON: /api/errors/1d4cec11a39e0183.
Report an issue: GitHub.