testcontainers/testcontainers-java · error · IllegalArgumentException
The provided service (service) has no quota to configure
Error message
The provided service (service) has no quota to configure
What it means
CouchbaseContainer.withServiceQuota throws IllegalArgumentException when the given CouchbaseService does not have a configurable memory quota (hasQuota() is false). Services such as EVENTING do not take a memory quota, so asking to configure one is invalid. The check runs before the container starts (checkNotRunning).
Solutions
- Only call withServiceQuota for services where CouchbaseService.hasQuota() is true (KV, INDEX, QUERY, SEARCH, ANALYTICS).
- Guard the call with if (service.hasQuota()) { ... }.
- Remove the quota configuration for services like EVENTING and rely on defaults.
Example fix
// before
for (CouchbaseService s : services) {
container.withServiceQuota(s, 1024);
}
// after
for (CouchbaseService s : services) {
if (s.hasQuota()) {
container.withServiceQuota(s, 1024);
}
} Defensive patterns
Strategy: validation
Validate before calling
if (service.hasQuota()) {
container.withServiceQuota(service, quotaMb);
} Try / catch
try {
container.withServiceQuota(service, quotaMb);
} catch (IllegalArgumentException e) {
logger.warn("Service {} has no configurable quota, skipping", service);
} Prevention
- Check hasQuota() before applying quotas.
- Know that EVENTING (and similar) services take no memory quota.
- Don't blanket-apply quotas across all enabled services.
When it happens
Trigger: Calling container.withServiceQuota(CouchbaseService.EVENTING, 1024) (or another quota-less service) with any quotaMb value.
Common situations: Iterating over all enabled services and setting a quota on each; guessing which services support quotas; refactoring code that previously applied quotas uniformly.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- The number of replicas must be between 0 and 3 (inclusive)
- Bucket quota cannot be less than 100MB!
- The custom quota (quotaMb) must not be smaller than the…
- The Analytics Service is only supported with the Enterprise…
- The Eventing Service is only supported with the Enterprise…
AI-assisted analysis of testcontainers/testcontainers-java@8e549514e3 (2026-09-12).
Data as JSON: /api/errors/bd4eea5855ac19af.
Report an issue: GitHub.
Appendix: source
Thrown at modules/couchbase/src/main/java/org/testcontainers/couchbase/CouchbaseContainer.java:180
}
public CouchbaseContainer withEnabledServices(final CouchbaseService... enabled) {
checkNotRunning();
this.enabledServices = EnumSet.copyOf(Arrays.asList(enabled));
return this;
}
/**
* Configures a custom memory quota for a given service.
*
* @param service the service to configure the quota for.
* @param quotaMb the memory quota in MB.
* @return this {@link CouchbaseContainer} for chaining purposes.
*/
public CouchbaseContainer withServiceQuota(final CouchbaseService service, final int quotaMb) {
checkNotRunning();
if (!service.hasQuota()) {
throw new IllegalArgumentException("The provided service (" + service + ") has no quota to configure");
}
if (quotaMb < service.getMinimumQuotaMb()) {
throw new IllegalArgumentException(
"The custom quota (" +
quotaMb +
") must not be smaller than the " +
"minimum quota for the service (" +
service.getMinimumQuotaMb() +
")"
);
}
this.customServiceQuotas.put(service, quotaMb);
return this;
}
/**
* Enables the analytics service which is not enabled by default.
*View on GitHub (pinned to 8e549514e3)