apolloconfig/apollo · error · ServiceException
namespace[appId = %s, cluster= %s] nowCount= %s, maxCount =%
Error message
namespace[appId = %s, cluster= %s] nowCount= %s, maxCount =%s
What it means
Thrown as ServiceException (HTTP 500) by NamespaceService.save when namespace.num.limit.enabled is true, the appId is not in the namespace.num.limit.white whitelist, and the current namespace count for that (appId, clusterName) already meets namespace.num.limit. This caps how many namespaces a cluster can hold.
Source
Thrown at apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/NamespaceService.java:367
messageSender.sendMessage(
ReleaseMessageKeyGenerator.generate(appId, clusterName, namespaceName),
Topics.APOLLO_RELEASE_TOPIC);
return deleted;
}
@Transactional
public Namespace save(Namespace entity) {
if (!isNamespaceUnique(entity.getAppId(), entity.getClusterName(), entity.getNamespaceName())) {
throw new ServiceException("namespace not unique");
}
if (bizConfig.isNamespaceNumLimitEnabled()
&& !bizConfig.namespaceNumLimitWhite().contains(entity.getAppId())) {
int nowCount = namespaceRepository.countByAppIdAndClusterName(entity.getAppId(),
entity.getClusterName());
if (nowCount >= bizConfig.namespaceNumLimit()) {
throw new ServiceException(
"namespace[appId = " + entity.getAppId() + ", cluster= " + entity.getClusterName()
+ "] nowCount= " + nowCount + ", maxCount =" + bizConfig.namespaceNumLimit());
}
}
entity.setId(0);// protection
Namespace namespace = namespaceRepository.save(entity);
auditService.audit(Namespace.class.getSimpleName(), namespace.getId(), Audit.OP.INSERT,
namespace.getDataChangeCreatedBy());
return namespace;
}
@Transactional
public Namespace update(Namespace namespace) {
Namespace managedNamespace = namespaceRepository.findByAppIdAndClusterNameAndNamespaceName(
namespace.getAppId(), namespace.getClusterName(), namespace.getNamespaceName());View on GitHub (pinned to d95fc18d11)
Solutions
- Raise namespace.num.limit for the deployment, or add the appId to namespace.num.limit.white.
- Re-use existing namespaces or consolidate config instead of adding new ones.
- Move work into a different cluster that has headroom.
Example fix
# portal admin config namespace.num.limit.enabled = true namespace.num.limit = 200 namespace.num.limit.white = specialApp1,specialApp2
Defensive patterns
Strategy: validation
Validate before calling
if (bizConfig.isNamespaceNumLimitEnabled()
&& !bizConfig.namespaceNumLimitWhite().contains(appId)) {
int now = namespaceRepository.countByAppIdAndClusterName(appId, clusterName);
if (now >= bizConfig.namespaceNumLimit()) {
// do not call save; raise limit / whitelist / use another cluster
}
} Try / catch
try {
namespaceService.save(entity);
} catch (ServiceException e) {
if (e.getMessage().contains("maxCount")) { /* quota handling */ }
else throw e;
} Prevention
- Track namespace counts per cluster against the configured cap.
- Pre-flight new namespaces against namespace.num.limit before save.
- Keep an allowlist for high-volume apps in namespace.num.limit.white.
When it happens
Trigger: Creating a new namespace in a cluster whose namespace count is already >= the configured namespace.num.limit, for an appId that is not whitelisted.
Common situations: Tenant/multi-team clusters hitting the namespace cap; envs where ops set a low namespace limit; automated pipelines creating many namespaces.
Related errors
- namespace not unique
- AccessKeys count limit exceeded
- appnamespace not unique
- value too long. length limit:%s
- key too long. length limit:%s
AI-assisted analysis of apolloconfig/apollo@d95fc18d11 (2026-08-14).
Data as JSON: /api/errors/d9316a71145baf47.
Report an issue: GitHub.