testcontainers/testcontainers-java · error · IllegalStateException

The Analytics Service is only supported with the Enterprise…

Error message

The Analytics Service is only supported with the Enterprise version

What it means

initializeIsEnterprise() determines whether the running image is Couchbase Enterprise by reading isEnterprise from /pools. If it is the Community edition and the ANALYTICS service was requested via withServiceQuota/withServices, the container throws IllegalStateException, because the Analytics Service exists only in Enterprise Edition.

Solutions

  1. Use an Enterprise Edition image, e.g. couchbase:enterprise-7.x.
  2. Remove ANALYTICS from the enabled services / delete the withServiceQuota(CouchbaseService.ANALYTICS, ...) call.
  3. If Analytics is needed but only Community is allowed, redesign the test to not use the Analytics Service.

Example fix

// before
new CouchbaseContainer(DockerImageName.parse("couchbase:community-7.0.2"))
    .withServiceQuota(CouchbaseService.ANALYTICS, 1024)
// after
new CouchbaseContainer(DockerImageName.parse("couchbase:enterprise-7.1.1"))
    .withServiceQuota(CouchbaseService.ANALYTICS, 1024)
Defensive patterns

Strategy: validation

Validate before calling

if (!image.contains("enterprise") && services.contains(CouchbaseService.ANALYTICS)) {
    throw new IllegalStateException("ANALYTICS requires an Enterprise image");
}

Try / catch

try {
    container.start();
} catch (IllegalStateException e) {
    if (e.getMessage().contains("Analytics Service is only supported with the Enterprise")) {
        // rebuild container without ANALYTICS or with an enterprise image
    } else {
        throw e;
    }
}

Prevention

When it happens

Trigger: Building a CouchbaseContainer from a Community image (e.g. couchbase:community) while calling .withServiceQuota(CouchbaseService.ANALYTICS, quota) or enabling ANALYTICS in the service set.

Common situations: Switching the image to a community tag to avoid licensing; CI images pinned to community; forgetting ANALYTICS was enabled when downgrading images.

Understand the failure class

Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.

Related errors


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

Appendix: source

Thrown at modules/couchbase/src/main/java/org/testcontainers/couchbase/CouchbaseContainer.java:395

        new HttpWaitStrategy().forPort(MGMT_PORT).forPath("/pools").forStatusCode(200).waitUntilReady(this);
    }

    /**
     * Fetches edition (enterprise or community) of started container.
     */
    private void initializeIsEnterprise() {
        @Cleanup
        Response response = doHttpRequest(MGMT_PORT, "/pools", "GET", null, true);

        try {
            isEnterprise = MAPPER.readTree(response.body().string()).get("isEnterprise").asBoolean();
        } catch (IOException e) {
            throw new IllegalStateException("Couchbase /pools did not return valid JSON");
        }

        if (!isEnterprise) {
            if (enabledServices.contains(CouchbaseService.ANALYTICS)) {
                throw new IllegalStateException("The Analytics Service is only supported with the Enterprise version");
            }
            if (enabledServices.contains(CouchbaseService.EVENTING)) {
                throw new IllegalStateException("The Eventing Service is only supported with the Enterprise version");
            }
        }
    }

    /**
     * Initializes the {@link #hasTlsPorts} flag.
     * <p>
     * Community Edition might support TLS one happy day, so use a "supports TLS" flag separate from
     * the "enterprise edition" flag.
     */
    private void initializeHasTlsPorts() {
        @Cleanup
        Response response = doHttpRequest(MGMT_PORT, "/pools/default/nodeServices", "GET", null, true);

        try {

View on GitHub (pinned to 8e549514e3)