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
- Extend the timeout: new CassandraQueryWaitStrategy().withStartupTimeout(Duration.ofMinutes(5))
- Switch to org.testcontainers.cassandra.CassandraQueryWaitStrategy (non-deprecated) and configure a longer startup timeout
- 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
- Replace the deprecated strategy with org.testcontainers.cassandra.CassandraQueryWaitStrategy
- Set startup timeout >= 5 minutes for Cassandra in CI
- Verify image and memory headroom
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.
- Timeouts: ETIMEDOUT, deadlines, and hung requests — what actually expires when a request times out.
Related errors
- Timed out waiting for Cassandra to be accessible for query…
- Timed out waiting for URL to be accessible
- Timed out waiting for log output matching
- Timed out waiting for container to execute
- Changing startup timeout is not supported with mode
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)