{"record":{"id":"83e03bfc3f2300ea","repo":"testcontainers/testcontainers-java","slug":"the-custom-quota-quotamb-must-not-be-smaller-than-the","errorCode":null,"errorMessage":"The custom quota (quotaMb) must not be smaller than the minimum quota for the service (service.getMinimumQuotaMb())","messagePattern":"The custom quota \\(quotaMb\\) must not be smaller than the minimum quota for the service \\(service\\.getMinimumQuotaMb\\(\\)\\)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/couchbase/src/main/java/org/testcontainers/couchbase/CouchbaseContainer.java","lineNumber":183,"sourceCode":"        checkNotRunning();\n        this.enabledServices = EnumSet.copyOf(Arrays.asList(enabled));\n        return this;\n    }\n\n    /**\n     * Configures a custom memory quota for a given service.\n     *\n     * @param service the service to configure the quota for.\n     * @param quotaMb the memory quota in MB.\n     * @return this {@link CouchbaseContainer} for chaining purposes.\n     */\n    public CouchbaseContainer withServiceQuota(final CouchbaseService service, final int quotaMb) {\n        checkNotRunning();\n        if (!service.hasQuota()) {\n            throw new IllegalArgumentException(\"The provided service (\" + service + \") has no quota to configure\");\n        }\n        if (quotaMb < service.getMinimumQuotaMb()) {\n            throw new IllegalArgumentException(\n                \"The custom quota (\" +\n                quotaMb +\n                \") must not be smaller than the \" +\n                \"minimum quota for the service (\" +\n                service.getMinimumQuotaMb() +\n                \")\"\n            );\n        }\n        this.customServiceQuotas.put(service, quotaMb);\n        return this;\n    }\n\n    /**\n     * Enables the analytics service which is not enabled by default.\n     *\n     * @return this {@link CouchbaseContainer} for chaining purposes.\n     */\n    public CouchbaseContainer withAnalyticsService() {","sourceCodeStart":165,"sourceCodeEnd":201,"githubUrl":"https://github.com/testcontainers/testcontainers-java/blob/8e549514e3f01c57d70546fbb8599d138f3903e5/modules/couchbase/src/main/java/org/testcontainers/couchbase/CouchbaseContainer.java#L165-L201","documentation":"CouchbaseContainer.withServiceQuota throws IllegalArgumentException when quotaMb is smaller than the service's minimum memory quota (service.getMinimumQuotaMb()). Each Couchbase service has its own server-enforced minimum; Testcontainers validates it eagerly before container start.","triggerScenarios":"Calling e.g. container.withServiceQuota(CouchbaseService.KV, 100) when the KV service minimum is 256 MB.","commonSituations":"Applying a bucket-level 100MB minimum to service quotas; copying one service's quota to another with a higher minimum; memory-saving attempts below server limits.","solutions":["Raise quotaMb to at least service.getMinimumQuotaMb(), e.g. container.withServiceQuota(CouchbaseService.KV, Math.max(quotaMb, service.getMinimumQuotaMb())).","Check CouchbaseService.getMinimumQuotaMb() for the specific service's floor before calling.","If the host is memory-constrained, enable fewer services instead of lowering quotas."],"exampleFix":"// before\ncontainer.withServiceQuota(CouchbaseService.KV, 100)\n// after\nint quota = Math.max(100, CouchbaseService.KV.getMinimumQuotaMb());\ncontainer.withServiceQuota(CouchbaseService.KV, quota)","handlingStrategy":"validation","validationCode":"int quota = Math.max(quotaMb, service.getMinimumQuotaMb());\ncontainer.withServiceQuota(service, quota);","typeGuard":null,"tryCatchPattern":"try {\n    container.withServiceQuota(service, quotaMb);\n} catch (IllegalArgumentException e) {\n    container.withServiceQuota(service, service.getMinimumQuotaMb());\n}","preventionTips":["Always derive quota from service.getMinimumQuotaMb() rather than hardcoding.","Don't assume the 100MB bucket minimum applies to service quotas.","Budget host memory against the sum of service minimums."],"tags":["testcontainers","couchbase","validation","quota"],"backgroundTag":"value-out-of-range","analyzedSha":"8e549514e3f01c57d70546fbb8599d138f3903e5","analyzedAt":"2026-09-12T14:56:41.227Z","contentChangedAt":"2026-09-12T14:56:41.227Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}