elastic/elasticsearch · error · GradleException

Reaper process failed. Check log at {} for details

Error message

Reaper process failed. Check log at {} for details

What it means

ReaperService.shutdown() throws GradleException when the reaper subprocess exits with a non-zero code on close. The reaper is a small JVM launched to outlive the Gradle build and kill any spawned processes if Gradle dies; at clean shutdown, Gradle closes its stdin to signal exit. A non-zero waitFor() result means the reaper itself errored during its run or shutdown, and reaper.log holds the cause.

Source

Thrown at build-tools/src/main/java/org/elasticsearch/gradle/ReaperService.java:82

    }

    public void unregister(String serviceId) {
        try {
            Files.deleteIfExists(getCmdFile(serviceId));
        } catch (IOException e) {
            throw new UncheckedIOException(e);
        }
    }

    void shutdown() {
        if (reaperProcess != null) {
            ensureReaperAlive();
            try {
                reaperProcess.getOutputStream().close();
                logger.info("Waiting for reaper to exit normally");
                if (reaperProcess.waitFor() != 0) {
                    Path inputDir = getParameters().getInputDir().get().getAsFile().toPath();
                    throw new GradleException("Reaper process failed. Check log at " + inputDir.resolve("reaper.log") + " for details");
                }
            } catch (Exception e) {
                throw new RuntimeException(e);
            }

        }
    }

    private synchronized void ensureReaperStarted() {
        if (reaperProcess == null) {
            try {
                Path jarPath = locateReaperJar();
                Path inputDir = getParameters().getInputDir().get().getAsFile().toPath();

                // ensure the input directory exists
                Files.createDirectories(inputDir);
                // start the reaper
                ProcessBuilder builder = new ProcessBuilder(

View on GitHub (pinned to db6a809a66)

Solutions

  1. Read reaper.log at the path named in the exception (typically .gradle/reaper/build-<pid>/reaper.log) for the reaper's stack trace.
  2. Verify the launched JVM (Jvm.current()) is functional and can run the reaper JAR.
  3. Check that the reaper's input directory and .cmd files are intact and writable.
  4. If kills are failing, check OS permissions for the Gradle process to signal the spawned PIDs.
Defensive patterns

Strategy: try-catch

Try / catch

try { reaperService.close(); } catch (GradleException e) { Path log = Paths.get(e.getMessage().replaceAll(".*log at ", "").replaceAll(" for details", "")); Files.lines(log).forEach(log::error); throw e; }

Prevention

When it happens

Trigger: The reaper JVM (launched in ensureReaperStarted()) returns a non-zero exit code when Gradle signals shutdown via stdin close. The log file at <inputDir>/reaper.log (inputDir is .gradle/reaper/build-<pid>/) contains the reaper's own stdout/stderr.

Common situations: The reaper JAR is corrupted or incompatible with the launched JVM; the reaper hit an uncaught exception while reading .cmd files or executing kill commands; the input directory was deleted out from under the reaper; OS-level kill failures (insufficient permissions to kill a spawned PID).

Related errors


AI-assisted analysis of elastic/elasticsearch@db6a809a66 (2026-08-12). Data as JSON: /api/errors/661d6d9cbac53b43. Report an issue: GitHub.