alibaba/nacos · warning · IllegalArgumentException
Param 'resourcePattern' is illegal, resourcePattern is blank
Error message
Param 'resourcePattern' is illegal, resourcePattern is blank
What it means
Thrown by FuzzyGroupKeyPattern.generatePattern when resourcePattern (the dataId/service-name pattern) is blank (null, empty, or whitespace only). This is the first validation in the method; groupPattern and fixNamespace are checked next. The result pattern is fixNamespace>>groupPattern>>resourcePattern, so a blank resourcePattern makes the key meaningless.
Source
Thrown at common/src/main/java/com/alibaba/nacos/common/utils/FuzzyGroupKeyPattern.java:54
* @author stone-98
* @date 2024/3/14
*/
public class FuzzyGroupKeyPattern {
/**
* Generates a fuzzy listen group key pattern based on the given dataId pattern, group, and optional tenant. pattern
* result as: fixNamespace>>groupPattern>>dataIdPattern
*
* @param resourcePattern The pattern for matching dataIds or service names.
* @param groupPattern The groupPattern associated with the groups.
* @param fixNamespace (Optional) The tenant associated with the dataIds (can be null or empty).
* @return A unique group key pattern for fuzzy listen.
* @throws IllegalArgumentException If the dataId pattern or group is blank.
*/
public static String generatePattern(final String resourcePattern, final String groupPattern,
String fixNamespace) {
if (StringUtils.isBlank(resourcePattern)) {
throw new IllegalArgumentException(
"Param 'resourcePattern' is illegal, resourcePattern is blank");
}
if (StringUtils.isBlank(groupPattern)) {
throw new IllegalArgumentException("Param 'groupPattern' is illegal, group is blank");
}
if (StringUtils.isBlank(fixNamespace)) {
fixNamespace = DEFAULT_NAMESPACE_ID;
}
StringBuilder sb = new StringBuilder();
sb.append(fixNamespace);
sb.append(FUZZY_WATCH_PATTERN_SPLITTER);
sb.append(groupPattern);
sb.append(FUZZY_WATCH_PATTERN_SPLITTER);
sb.append(resourcePattern);
return sb.toString().intern();
}
/**View on GitHub (pinned to 9b989acdf1)
Solutions
- Validate the resourcePattern is non-blank at the API/UI boundary before calling fuzzy subscribe.
- Require a wildcard pattern (e.g., 'prefix-*') — fuzzy listen expects a pattern, not an empty string.
- Trim and reject blank input in the request form validator.
Example fix
// before
String key = FuzzyGroupKeyPattern.generatePattern(dataIdPattern, group, namespace);
// after
if (StringUtils.isBlank(dataIdPattern)) {
throw new IllegalArgumentException("dataIdPattern is required for fuzzy listen");
}
String key = FuzzyGroupKeyPattern.generatePattern(dataIdPattern, group, namespace); Defensive patterns
Strategy: validation
Validate before calling
if (StringUtils.isBlank(resourcePattern)) {
throw new IllegalArgumentException("A non-blank resourcePattern is required for fuzzy listen");
}
String key = FuzzyGroupKeyPattern.generatePattern(resourcePattern, groupPattern, fixNamespace); Prevention
- Validate resourcePattern at the API/UI boundary before subscribing.
- Require a wildcard pattern for fuzzy listen; never submit an empty dataId/service pattern.
When it happens
Trigger: Registering a fuzzy listen/watch with a blank dataId or service-name pattern. Entry point: fuzzy config listen or fuzzy service watch APIs that ultimately call generatePattern.
Common situations: UI or API caller submitting a fuzzy subscribe with an empty pattern field; a default that resolved to null; whitespace-only input not trimmed upstream.
Related errors
- Param 'groupPattern' is illegal, group is blank
- distroThreshold can not be zero or negative: {threshold}
- illegal format, must be 'type:version', but got: {value}
- illegal version, must match: {UtilsAndCommons.VERSION_STRING
- 10000
AI-assisted analysis of alibaba/nacos@9b989acdf1 (2026-08-14).
Data as JSON: /api/errors/8071bef866b036d1.
Report an issue: GitHub.