apache/shenyu · error · WebI18nException
WebI18nException(message, objects)
Error message
WebI18nException(message, objects)
What it means
WebI18nAssert.fail throws a WebI18nException carrying the message key plus optional i18n arguments. It is the assertion mechanism used across shenyu-admin for parameter/state validation, with the message resolved to the caller's locale at the API layer. Raised from isTrue and similar assert helpers.
Solutions
- Read the exception's message key and look it up in the admin i18n resource bundle to see the human-readable cause.
- Fix the request payload so the asserted condition holds (fill required fields, use valid values).
- In your own code, prefer pre-checking conditions instead of relying on the assert to reject them.
Example fix
// before
webI18nAssertPayload(name, null); // fails WebI18nAssert.notBlank
// after
// ensure required fields present before calling the admin API
request.setName("myPlugin"); // all required fields populated Defensive patterns
Strategy: validation
Validate before calling
// client-side pre-check before calling admin API
if (name == null || name.isBlank()) {
throw new IllegalArgumentException("name is required");
}
WebI18nAssert.isTrue(StringUtils.isNotBlank(name), "plugin.name.required"); Type guard
static <T> T requireNonNull(T value, String i18nKey) {
if (value == null) { WebI18nAssert.fail(i18nKey); }
return value;
} Try / catch
try {
adminService.createSelector(request);
} catch (WebI18nException e) {
// resolve e.getMessage() i18n key and map to a user-facing message
String userMessage = messageSource.getMessage(e.getMessage(), e.getObjects(), locale);
} Prevention
- Resolve the message key in the admin i18n bundle to identify the exact failed assertion.
- Validate payloads client-side before calling admin REST endpoints.
- Keep required-field lists in sync with the dashboard forms.
When it happens
Trigger: Any code path calling WebI18nAssert.isTrue(cond, "key", args...) (or related asserts) when the condition is false — e.g. missing request parameters, invalid enum values in admin REST endpoints, or business preconditions failing.
Common situations: Dashboard/API clients sending malformed or incomplete payloads to shenyu-admin endpoints (create/update plugin, selector, rule) and hitting a validation assert.
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
- The URI must start with '/'
- namespaceId is null
- namespaceId is not exist
- uri validation of Condition failed, please check.
AI-assisted analysis of apache/shenyu@567142e072 (2026-09-12).
Data as JSON: /api/errors/14122766171786b4.
Report an issue: GitHub.
Appendix: source
Thrown at shenyu-admin/src/main/java/org/apache/shenyu/admin/utils/WebI18nAssert.java:100
*
* @param test string
* @param message error message
* @param objects objects
*/
public static void isTrue(final Boolean test, final String message, final Object... objects) {
if (!Boolean.TRUE.equals(test)) {
fail(message, objects);
}
}
/**
* fail.
*
* @param message message
* @param objects objects
*/
public static void fail(final String message, final Object... objects) {
throw new WebI18nException(message, objects);
}
}
View on GitHub (pinned to 567142e072)