apache/shenyu · error · ShenyuAdminException
uri validation of Condition failed, please check.
Error message
uri validation of Condition failed, please check.
What it means
RuleService.createOrUpdate validates rule conditions before persisting: for every condition whose paramType is 'uri', UriConditionValidator.checks the operator/paramValue combination (uri regex/validity). Any validation exception is wrapped in ShenyuAdminException("uri validation of Condition failed, please check.") and the rule is not created or updated. The wrapped cause names the exact operator/value problem.
Solutions
- Look at the wrapped cause in the log — UriConditionValidator says which condition's operator/value is invalid.
- Fix the rule condition paramValue: for the regex operator supply a valid Java regex (e.g. /foo/**, no unbalanced brackets).
- Ensure the operator matches the paramType 'uri' (one of =, match, regex, etc.) and paramValue is non-empty.
- Test the pattern locally with Pattern.compile() before submitting it through the dashboard/API.
Example fix
// before (invalid regex)
{ "paramType": "uri", "operator": "regex", "paramValue": "/foo/**(" }
// after
{ "paramType": "uri", "operator": "regex", "paramValue": "/foo/**" } Defensive patterns
Strategy: validation
Validate before calling
// client-side pre-check for uri regex conditions
try {
java.util.regex.Pattern.compile(conditionData.getParamValue());
} catch (java.util.regex.PatternSyntaxException e) {
throw new IllegalArgumentException("invalid uri regex: " + conditionData.getParamValue());
} Try / catch
try {
ruleService.createOrUpdate(ruleDTO);
} catch (ShenyuAdminException e) {
if (e.getMessage().contains("uri validation"))
LOG.warn("reject rule {}: invalid uri condition (see cause)", ruleDTO.getId(), e.getCause());
} Prevention
- Test regex patterns with Pattern.compile before submitting
- Keep paramValue non-empty and percent-encode special characters
- Only use operators supported for the 'uri' paramType
- Validate rule payloads in CI scripts that automate rule creation
When it happens
Trigger: Saving a rule via the admin API/dashboard with a URI condition whose paramValue is not valid for the chosen operator — e.g. an invalid regex for the 'regex' operator, malformed path pattern, or illegal characters for '='/'match' operators.
Common situations: Dashboard users typing hand-crafted regex with unbalanced brackets or invalid escapes; automation scripts posting rule JSON with empty uri paramValue; copy-pasted patterns containing whitespace or unencoded characters; version differences in what operators accept.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- parameter error
- unique index conflict, please enter again
- The user namespace rel is exist!
- registry_id is already exist
- registry is not exist
AI-assisted analysis of apache/shenyu@567142e072 (2026-09-12).
Data as JSON: /api/errors/7721c499362f416c.
Report an issue: GitHub.
Appendix: source
Thrown at shenyu-admin/src/main/java/org/apache/shenyu/admin/service/RuleService.java:65
*/
String registerDefault(RuleDTO ruleDTO);
/**
* create or update rule.
*
* @param ruleDTO {@linkplain RuleDTO}
* @return rows int
*/
default int createOrUpdate(final RuleDTO ruleDTO) {
try {
final List<RuleConditionDTO> ruleConditions = ruleDTO.getRuleConditions();
ruleConditions.stream()
.filter(conditionData -> ParamTypeEnum.URI.getName().equals(conditionData.getParamType()))
.forEach(conditionData -> {
UriConditionValidator.validate(conditionData.getOperator(), conditionData.getParamValue());
});
} catch (Exception e) {
throw new ShenyuAdminException("uri validation of Condition failed, please check.", e);
}
return StringUtils.isBlank(ruleDTO.getId()) ? create(ruleDTO) : update(ruleDTO);
}
/**
* create rule.
*
* @param ruleDTO {@linkplain RuleDTO}
* @return rows int
*/
int create(RuleDTO ruleDTO);
/**
* update rule.
*
* @param ruleDTO {@linkplain RuleDTO}
* @return rows int
*/View on GitHub (pinned to 567142e072)