apache/cassandra · error · RuntimeException

Error while rebuilding node: ${e.getCause().getMessage()}

Error message

Error while rebuilding node: ${e.getCause().getMessage()}

What it means

When rebuild is invoked via JMX, the streaming future's ExecutionException is logged with full trace but rethrown as a simple RuntimeException carrying only the root cause's message, so the operator gets a one-line reason (e.g. a stream failure) without a stack.

Source

Thrown at src/java/org/apache/cassandra/service/Rebuild.java:180

            }

            StreamResultFuture streamResult = streamer.fetchAsync();

            Future<?> accordReady = AccordService.instance().epochReadyFor(metadata, EpochReady::reads);
            Future<?> ready = FutureCombiner.allOf(streamResult, accordReady);

            // wait for result
            ready.get();
        }
        catch (InterruptedException e)
        {
            throw new UncheckedInterruptedException(e);
        }
        catch (ExecutionException e)
        {
            // This is used exclusively through JMX, so log the full trace but only throw a simple RTE
            logger.error("Error while rebuilding node", e.getCause());
            throw new RuntimeException("Error while rebuilding node: " + e.getCause().getMessage());
        }
        finally
        {
            // rebuild is done (successfully or not)
            isRebuilding.set(false);
        }
    }


    private static RangesAtEndpoint rangesForRebuildWithTokens(String tokens, String keyspace)
    {
        Token.TokenFactory factory = StorageService.instance.getTokenFactory();
        List<Range<Token>> ranges = new ArrayList<>();
        Pattern rangePattern = Pattern.compile("\\(\\s*(-?\\w+)\\s*,\\s*(-?\\w+)\\s*\\]");
        try (Scanner tokenScanner = new Scanner(tokens))
        {
            while (tokenScanner.findInLine(rangePattern) != null)
            {

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Read the full 'Error while rebuilding node' stack trace in the node's log to find the root cause
  2. Fix the underlying stream failure (restart dead peer, restore network, correct auth) and rerun `nodetool rebuild`
  3. Check `nodetool netstats` and system.log/systemd journal for StreamSession errors before retrying
Defensive patterns

Strategy: try-catch

Validate before calling

// pre-check peers are up before rebuild
if (!StreamsCoordinator healthy || peerDown(sourceDcNodes)) postponeRebuild();

Try / catch

try { rebuild(...); }
catch (RuntimeException e) {
    logger.error("rebuild failed: {}", e.getMessage(), e);
    // full cause is in the server log under 'Error while rebuilding node'
    alertOpsAndRetryAfterFix(e);
}

Prevention

When it happens

Trigger: Underlying StreamPlan/stream session fails during rebuild (node down, network partition, hinted-handoff issues) and the rebuild() call surfaces the failure asynchronously via Future.get().

Common situations: Source node crashed mid-stream; network interruption between DCs; TLS or internode auth failures during streaming; disk failure on the rebuilding node.

Understand the failure class

Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.

Related errors


AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10). Data as JSON: /api/errors/193d05d7c677918b. Report an issue: GitHub.