Skip to content

Unhandled Promise Rejection (ARCH4031)

Key java.async.missing-future-exceptionally · Severity warning · Category async

When a future chain is left without a rejection handler (exceptionally/handle), a thrown exception becomes an unhandled rejection that is silently swallowed.

fetchUser(id)
.thenApply(this::render)
.thenAccept(this::send); // no rejection handler
fetchUser(id)
.thenApply(this::render)
.thenAccept(this::send)
.exceptionally(ex -> {
log.error("failed to process user", ex);
return null;
});

Attach an exceptionally or handle stage to the future chain to log or compensate for rejections.