alibaba/nacos · error · IllegalArgumentException
too long tag, over 16
Error message
too long tag, over 16
What it means
Thrown by the v1 single-tag overload ParamUtils.checkParam(String tag) as an IllegalArgumentException when tag.length() exceeds TAG_MAX_LEN (16). It is an unchecked runtime exception with no error code/HTTP status. Enforces short, machine-friendly tags for indexing and push filtering.
Source
Thrown at config/src/main/java/com/alibaba/nacos/config/server/utils/ParamUtils.java:140
}
if (StringUtils.isBlank(group) || !isValid(group)) {
throw new NacosApiException(HttpStatus.BAD_REQUEST.value(),
ErrorCode.PARAMETER_VALIDATE_ERROR,
"invalid group : " + group);
}
checkTenantV2(namespaceId);
}
/**
* Check the tag for [v1].
*/
public static void checkParam(String tag) {
if (StringUtils.isNotBlank(tag)) {
if (!isValid(tag.trim())) {
throw new IllegalArgumentException("invalid tag : " + tag);
}
if (tag.length() > TAG_MAX_LEN) {
throw new IllegalArgumentException("too long tag, over 16");
}
}
}
/**
* Check the config info for [v1] and [v2].
*/
public static void checkParam(Map<String, Object> configAdvanceInfo) throws NacosException {
for (Map.Entry<String, Object> configAdvanceInfoTmp : configAdvanceInfo.entrySet()) {
if (CONFIG_TAGS.equals(configAdvanceInfoTmp.getKey())) {
if (configAdvanceInfoTmp.getValue() != null) {
String[] tagArr = ((String) configAdvanceInfoTmp.getValue()).split(",");
if (tagArr.length > 5) {
throw new NacosApiException(HttpStatus.BAD_REQUEST.value(),
ErrorCode.PARAMETER_VALIDATE_ERROR,
"too much config_tags, over 5");
}
for (String tag : tagArr) {View on GitHub (pinned to 9b989acdf1)
Solutions
- Shorten the tag to at most 16 characters.
- Move long descriptive metadata into the 'desc' advance-info field (max 128) instead of the tag.
- Use a compact encoding (e.g. abbreviated codes) for composite tag values.
Example fix
// before
ParamUtils.checkParam("production-blue-cluster"); // 24 chars
// after
ParamUtils.checkParam("prod-blue"); // 9 chars, fits TAG_MAX_LEN=16 Defensive patterns
Strategy: validation
Validate before calling
boolean validTagLength(String tag) {
return tag == null || tag.length() <= 16;
} Try / catch
try {
ParamUtils.checkParam(tag);
} catch (IllegalArgumentException e) {
handleInvalidTag(e.getMessage());
} Prevention
- Keep tags to short tokens (<=16 chars).
- Move long descriptive metadata into 'desc'.
- Use the v2 API for structured error responses.
When it happens
Trigger: A v1 config operation passing a tag whose length is greater than 16 characters (after the charset check passes).
Common situations: Using a descriptive sentence or UUID as a tag, concatenating env+version+region into one tag field.
Related errors
- invalid tag : {}
- too long tenant, over 128
- invalid tenant
- 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/f4312ab992e41f87.
Report an issue: GitHub.