testcontainers/testcontainers-java · error · UnsupportedOperationException

The ClickHouse does not support this

Error message

The ClickHouse does not support this

What it means

ClickHouseContainer overrides JDBC URL parameter customization to deliberately reject it. Calling withUrlParam on a ClickHouse container always throws UnsupportedOperationException('The ClickHouse does not support this'), because ClickHouse JDBC URL params are not routed through this mechanism.

Solutions

  1. Remove the withUrlParam call; configure driver settings through the JDBC URL string instead if needed
  2. Use the ClickHouse-specific configuration surface (image env vars / withEnv) for server settings
  3. Upgrade testcontainers if you need this feature — check whether a newer version supports URL params for ClickHouse

Example fix

// before
container.withUrlParam("socket_timeout", "300000");
// after
container.withUrlParamRemoved(); // or configure via JDBC URL / withEnv
JDBCContainer jdbc = new JDBCContainer().withUrl(...)
Defensive patterns

Strategy: validation

Validate before calling

if (container instanceof ClickHouseContainer) {
  // never call withUrlParam on ClickHouse containers
}

Try / catch

try { container.withUrlParam(k, v); } catch (UnsupportedOperationException e) { /* fall back to URL/env config */ }

Prevention

When it happens

Trigger: new ClickHouseContainer(...).withUrlParam("param", "value") — any call, immediately, before start().

Common situations: Copy-pasting container setup code from MySQL/Postgres examples (where withUrlParam is supported) into ClickHouse configuration.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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

Appendix: source

Thrown at modules/clickhouse/src/main/java/org/testcontainers/containers/ClickHouseContainer.java:121

    @Override
    public String getUsername() {
        return username;
    }

    @Override
    public String getPassword() {
        return password;
    }

    @Override
    public String getTestQueryString() {
        return TEST_QUERY;
    }

    @Override
    public ClickHouseContainer withUrlParam(String paramName, String paramValue) {
        throw new UnsupportedOperationException("The ClickHouse does not support this");
    }
}

View on GitHub (pinned to 8e549514e3)