alibaba/nacos · error · IllegalArgumentException
too long tenant, over 128
Error message
too long tenant, over 128
What it means
Thrown by the v1 ParamUtils.checkTenant(String tenant) as an IllegalArgumentException when tenant.length() exceeds TENANT_MAX_LEN (128). Unchecked runtime exception, no error code/HTTP status. Caps namespace/tenant identifier length for storage keys.
Source
Thrown at config/src/main/java/com/alibaba/nacos/config/server/utils/ParamUtils.java:237
}
if (tag.length() > TAG_MAX_LEN) {
throw new NacosApiException(HttpStatus.BAD_REQUEST.value(),
ErrorCode.PARAMETER_VALIDATE_ERROR,
"too long tag, over 16");
}
}
}
/**
* Check the tenant for [v1].
*/
public static void checkTenant(String tenant) {
if (StringUtils.isNotBlank(tenant)) {
if (!isValid(tenant.trim())) {
throw new IllegalArgumentException("invalid tenant");
}
if (tenant.length() > TENANT_MAX_LEN) {
throw new IllegalArgumentException("too long tenant, over 128");
}
}
}
/**
* Check the namespaceId for [v2].
*/
public static void checkTenantV2(String namespaceId) throws NacosApiException {
if (StringUtils.isNotBlank(namespaceId)) {
if (!isValid(namespaceId.trim())) {
throw new NacosApiException(HttpStatus.BAD_REQUEST.value(),
ErrorCode.PARAMETER_VALIDATE_ERROR,
"invalid namespaceId");
}
if (namespaceId.length() > TENANT_MAX_LEN) {
throw new NacosApiException(HttpStatus.BAD_REQUEST.value(),
ErrorCode.PARAMETER_VALIDATE_ERROR,
"too long namespaceId, over 128");View on GitHub (pinned to 9b989acdf1)
Solutions
- Shorten the tenant to at most 128 characters.
- Use the namespace's short generated id instead of a long descriptive name.
- Validate length client-side before calling.
Example fix
// before ParamUtils.checkTenant(longGeneratedNamespaceString); // > 128 // after String tenant = namespaceId; // short generated id, <= 128 ParamUtils.checkTenant(tenant);
Defensive patterns
Strategy: validation
Validate before calling
boolean validTenantLength(String tenant) {
return tenant == null || tenant.length() <= 128;
} Try / catch
try {
ParamUtils.checkTenant(tenant);
} catch (IllegalArgumentException e) {
handleInvalidTenant(e.getMessage());
} Prevention
- Use short generated namespace ids (<=128 chars).
- Avoid long descriptive names as tenant.
- Validate length client-side.
When it happens
Trigger: A v1 config operation passing a non-blank tenant longer than 128 characters (after charset check passes).
Common situations: Using a generated UUID concatenated with metadata, or a copy-pasted long string as tenant.
Related errors
- invalid tenant
- too long tag, over 16
- invalid tag : {}
- Plugin config value cannot be null: {key}
- Plugin config value must be positive: {key}
AI-assisted analysis of alibaba/nacos@9b989acdf1 (2026-08-14).
Data as JSON: /api/errors/2bd39b52e2fbbcb0.
Report an issue: GitHub.