{"record":{"id":"bd4eea5855ac19af","repo":"testcontainers/testcontainers-java","slug":"the-provided-service-service-has-no-quota-to-configure","errorCode":null,"errorMessage":"The provided service (service) has no quota to configure","messagePattern":"The provided service \\(service\\) has no quota to configure","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/couchbase/src/main/java/org/testcontainers/couchbase/CouchbaseContainer.java","lineNumber":180,"sourceCode":"    }\n\n    public CouchbaseContainer withEnabledServices(final CouchbaseService... enabled) {\n        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     *","sourceCodeStart":162,"sourceCodeEnd":198,"githubUrl":"https://github.com/testcontainers/testcontainers-java/blob/8e549514e3f01c57d70546fbb8599d138f3903e5/modules/couchbase/src/main/java/org/testcontainers/couchbase/CouchbaseContainer.java#L162-L198","documentation":"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).","triggerScenarios":"Calling container.withServiceQuota(CouchbaseService.EVENTING, 1024) (or another quota-less service) with any quotaMb value.","commonSituations":"Iterating over all enabled services and setting a quota on each; guessing which services support quotas; refactoring code that previously applied quotas uniformly.","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."],"exampleFix":"// before\nfor (CouchbaseService s : services) {\n    container.withServiceQuota(s, 1024);\n}\n// after\nfor (CouchbaseService s : services) {\n    if (s.hasQuota()) {\n        container.withServiceQuota(s, 1024);\n    }\n}","handlingStrategy":"validation","validationCode":"if (service.hasQuota()) {\n    container.withServiceQuota(service, quotaMb);\n}","typeGuard":null,"tryCatchPattern":"try {\n    container.withServiceQuota(service, quotaMb);\n} catch (IllegalArgumentException e) {\n    logger.warn(\"Service {} has no configurable quota, skipping\", service);\n}","preventionTips":["Check hasQuota() before applying quotas.","Know that EVENTING (and similar) services take no memory quota.","Don't blanket-apply quotas across all enabled services."],"tags":["testcontainers","couchbase","validation","configuration"],"backgroundTag":"invalid-argument-value","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"}