xpipe-io/xpipe · error · ValidationException
valueMustNotBeEmpty
Error message
valueMustNotBeEmpty
What it means
Validators.nonNull(Object) throws a ValidationException with the localized i18n key "valueMustNotBeEmpty" when the object is null. It is a generic null check for option/config values used throughout the app's validation pipeline.
Source
Thrown at app/src/main/java/io/xpipe/app/util/Validators.java:34
|| !c.isAssignableFrom(ref.getStore().getClass())) {
throw new ValidationException("Value must be an instance of " + c.getSimpleName());
}
}
public static <T extends DataStore> void isAnyType(DataStoreEntryRef<? extends T> ref, Class<?>... cs)
throws ValidationException {
if (ref == null
|| ref.getStore() == null
|| Arrays.stream(cs)
.noneMatch(c -> c.isAssignableFrom(ref.getStore().getClass()))) {
throw new ValidationException("Value must be an instance of "
+ Arrays.stream(cs).map(Class::getSimpleName).toList());
}
}
public static void nonNull(Object object) throws ValidationException {
if (object == null) {
throw new ValidationException(AppI18n.get("valueMustNotBeEmpty"));
}
}
public static void nonNull(Object object, String name) throws ValidationException {
if (object == null) {
throw new ValidationException(AppI18n.get("mustNotBeEmpty", name));
}
}
public static void contentNonNull(List<?> object) throws ValidationException {
if (object.stream().anyMatch(o -> o == null)) {
throw new ValidationException(AppI18n.get("valueMustNotBeEmpty"));
}
}
public static void notEmpty(String string) throws ValidationException {
if (string.strip().length() == 0) {
throw new ValidationException(AppI18n.get("valueMustNotBeEmpty"));View on GitHub (pinned to d85ca821ba)
Solutions
- Initialize the field or provide a default value before validation runs.
- Call the overload nonNull(object, name) to get a clearer message naming the field.
- Skip validation or substitute a sensible default when the value is legitimately optional.
Example fix
// before
Validators.nonNull(config.getTarget());
// after
if (config.getTarget() == null) {
config.setDefaultTarget();
}
Validators.nonNull(config.getTarget(), "target"); Defensive patterns
Strategy: validation
Validate before calling
if (value != null) {
Validators.nonNull(value);
} Type guard
public static boolean present(Object o) {
return o != null;
} Try / catch
try {
Validators.nonNull(value);
} catch (ValidationException e) {
// required value missing
} Prevention
- Mark required fields as required in UI/config schemas
- Provide defaults for commonly unset values
- Prefer the nonNull(value, name) overload for clearer errors
When it happens
Trigger: Validators.nonNull(x) where x is null — typically an unset configuration field or a lookup that returned null being validated.
Common situations: Required form fields left empty; optional config entries missing at validation time; API data that unexpectedly lacked a value.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- mustNotBeEmpty(${name})
- Name is empty
- Value must be an instance of ${className}
- Value must be an instance of ${classNames}
- Identity access scope is not currently accessible
AI-assisted analysis of xpipe-io/xpipe@d85ca821ba (2026-09-06).
Data as JSON: /api/errors/3e8d89ab5b334f61.
Report an issue: GitHub.