testcontainers/testcontainers-java · error · ContainerLaunchException

TIMEOUT_ERROR

Error message

TIMEOUT_ERROR

What it means

The deprecated legacy CassandraQueryWaitStrategy (modules/cassandra/.../wait/) throws ContainerLaunchException(TIMEOUT_ERROR) when its CQL probe does not succeed before the startup timeout. Functionally identical to the modern strategy error [80]; the constant TIMEOUT_ERROR holds 'Timed out waiting for Cassandra to be accessible for query execution'.

Solutions

  1. Extend the timeout: new CassandraQueryWaitStrategy().withStartupTimeout(Duration.ofMinutes(5))
  2. Switch to org.testcontainers.cassandra.CassandraQueryWaitStrategy (non-deprecated) and configure a longer startup timeout
  3. Inspect container logs for Cassandra bootstrap failures and fix the image/memory configuration

Example fix

// before
container.waitingFor(new org.testcontainers.containers.wait.CassandraQueryWaitStrategy());
// after
container.waitingFor(new org.testcontainers.cassandra.CassandraQueryWaitStrategy().withStartupTimeout(Duration.ofMinutes(5)));
Defensive patterns

Strategy: retry

Validate before calling

long timeoutMs = Duration.ofMinutes(5).toMillis(); // budget Cassandra's slow bootstrap

Try / catch

try { container.start(); } catch (ContainerLaunchException e) { /* TIMEOUT_ERROR: retry with extended startup timeout */ }

Prevention

When it happens

Trigger: container.start() with waitingFor(new CassandraQueryWaitStrategy()) where no probe query succeeds within the configured timeout.

Common situations: Slow startup on CI, undersized Docker resources, or a Cassandra image that fails to bootstrap; also using this deprecated strategy with images requiring longer init times.

Understand the failure class

Background: Request timed out: what client-side request timeouts mean across libraries (Request timed out, TIMED_OUT, APITimeoutError) — this error's family across 39 libraries.

Related errors


AI-assisted analysis of testcontainers/testcontainers-java@8e549514e3 (2026-09-12). Data as JSON: /api/errors/a9e4ba1a204c0640. Report an issue: GitHub.

Appendix: source

Thrown at modules/cassandra/src/main/java/org/testcontainers/containers/wait/CassandraQueryWaitStrategy.java:43

    @Override
    protected void waitUntilReady() {
        // execute select version query until success or timeout
        try {
            retryUntilSuccess(
                (int) startupTimeout.getSeconds(),
                TimeUnit.SECONDS,
                () -> {
                    getRateLimiter()
                        .doWhenReady(() -> {
                            try (DatabaseDelegate databaseDelegate = getDatabaseDelegate()) {
                                databaseDelegate.execute(SELECT_VERSION_QUERY, "", 1, false, false);
                            }
                        });
                    return true;
                }
            );
        } catch (TimeoutException e) {
            throw new ContainerLaunchException(TIMEOUT_ERROR);
        }
    }

    private DatabaseDelegate getDatabaseDelegate() {
        return new CassandraDatabaseDelegate(waitStrategyTarget);
    }
}

View on GitHub (pinned to 8e549514e3)