Async Error Swallowed (ARCH4169)
Key java.logging.future-exception-unhandled · Severity warning · Category logging
Starting a CompletableFuture chain with no error handler lets an async failure vanish silently. The exception is neither logged nor reaches the caller; the failure stays completely invisible.
Incorrect
Section titled “Incorrect”CompletableFuture.supplyAsync(() -> repository.load(id)) .thenAccept(cache::put);Correct
Section titled “Correct”CompletableFuture.supplyAsync(() -> repository.load(id)) .thenAccept(cache::put) .exceptionally(e -> { log.error("Async load failed: {}", id, e); return null; });Attach an error handler with exceptionally/handle to every async chain so rejections are logged.