apache/shenyu · error · IllegalArgumentException
The URI must be blank
Error message
The URI must be blank
What it means
The IS_BLANK operator's validator (blankPathValidator) requires the condition value to be blank/empty — that operator tests for an absent URI. If a non-blank value is supplied together with operator IS_BLANK, validation fails because the value is meaningless for that operator.
Solutions
- Pass an empty or null value when using the IS_BLANK operator.
- Change the operator to one that takes a value (e.g. EQ, PATH_PATTERN) if you actually meant to match a URI.
- Clear the value field in the dashboard when switching the operator to IS_BLANK.
Example fix
// before
UriConditionValidator.validate("isBlank", "/api/foo");
// after
UriConditionValidator.validate("isBlank", null); // or "" Defensive patterns
Strategy: validation
Validate before calling
if ("isBlank".equals(operator) && value != null && !value.isBlank()) { throw new IllegalArgumentException("Operator isBlank requires an empty value"); } Type guard
boolean isBlankOperatorValueValid(String operator, String value) { return !"isBlank".equals(operator) || (value == null || value.isBlank()); } Try / catch
try { UriConditionValidator.validate(operator, value); } catch (IllegalArgumentException e) { log.warn("Operator/value mismatch: {} {}", operator, value); } Prevention
- Clear the value field whenever you switch the operator to IS_BLANK.
- Validate operator/value pairing in the dashboard before submit.
- Centralize condition building so operator semantics are enforced in one place.
When it happens
Trigger: Calling UriConditionValidator.validate("isBlank", someValue) (or the OperatorEnum.IS_BLANK alias) with a value that is not null/empty — e.g. validate("isBlank", "/api").
Common situations: Selecting IS_BLANK in the dashboard but forgetting to clear the value field, or reusing condition-building code that always sets a value regardless of operator.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- The URI must start with '/'
- The URI cannot contain whitespaces. Current value: " + value
- The URI condition value cannot be empty.
- namespaceId is null
- namespaceId is not exist
AI-assisted analysis of apache/shenyu@567142e072 (2026-09-12).
Data as JSON: /api/errors/01c99813b3258ceb.
Report an issue: GitHub.
Appendix: source
Thrown at shenyu-admin/src/main/java/org/apache/shenyu/admin/validation/validator/UriConditionValidator.java:46
import java.util.function.Consumer;
public class UriConditionValidator {
private static final Map<String, Consumer<String>> VALIDATOR_MAP = new HashMap<>();
static {
Consumer<String> commonPathValidator = value -> {
if (!value.startsWith("/")) {
throw new IllegalArgumentException("The URI must start with '/'");
}
if (StringUtils.containsAny(value, " ", "\t", "\n")) {
throw new IllegalArgumentException(
"The URI cannot contain whitespaces. Current value: " + value);
}
};
Consumer<String> blankPathValidator = value -> {
if (StringUtils.isNotBlank(value)) {
throw new IllegalArgumentException("The URI must be blank");
}
};
VALIDATOR_MAP.put(OperatorEnum.PATH_PATTERN.getAlias(),
PathPatternParser.defaultInstance::parse);
VALIDATOR_MAP.put(OperatorEnum.REGEX.getAlias(), Pattern::compile);
VALIDATOR_MAP.put(OperatorEnum.EQ.getAlias(), commonPathValidator);
VALIDATOR_MAP.put(OperatorEnum.STARTS_WITH.getAlias(), commonPathValidator);
VALIDATOR_MAP.put(OperatorEnum.ENDS_WITH.getAlias(), commonPathValidator);
VALIDATOR_MAP.put(OperatorEnum.MATCH.getAlias(), commonPathValidator);
VALIDATOR_MAP.put(OperatorEnum.EXCLUDE.getAlias(), commonPathValidator);
VALIDATOR_MAP.put(OperatorEnum.CONTAINS.getAlias(), commonPathValidator);
VALIDATOR_MAP.put(OperatorEnum.IS_BLANK.getAlias(), blankPathValidator);
}
public static void validate(final String operator, final String value) {
if (!OperatorEnum.IS_BLANK.getAlias().equals(operator) && StringUtils.isBlank(value)) {
throw new IllegalArgumentException("The URI condition value cannot be empty.");
}View on GitHub (pinned to 567142e072)