xpipe-io/xpipe · error · ValidationException

mustNotBeEmpty(${name})

Error message

mustNotBeEmpty(${name})

What it means

Validators.nonNull(Object, String) checks that a named value is not null and throws a ValidationException with the localized message key "mustNotBeEmpty" parameterized with the field name. The thrown message is the i18n-formatted text, so it appears in the UI language with the name interpolated.

Source

Thrown at app/src/main/java/io/xpipe/app/util/Validators.java:40

            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

  1. Set the named field to a non-null value before calling validation.
  2. If the field is optional, remove the nonNull call or branch around it.
  3. Provide the correct field name so the error message points at the real culprit.

Example fix

// before
Validators.nonNull(entry.getName(), "Name");
// after
if (entry.getName() == null) {
    entry.setName("default");
}
Validators.nonNull(entry.getName(), "Name");
Defensive patterns

Strategy: validation

Validate before calling

if (value != null) {
    Validators.nonNull(value, name);
}

Type guard

public static boolean present(Object o) {
    return o != null;
}

Try / catch

try {
    Validators.nonNull(value, "target");
} catch (ValidationException e) {
    // named required field is null
}

Prevention

When it happens

Trigger: Validators.nonNull(value, "Name") where value is null; the name argument is only used for the message, so passing null value with any label triggers it.

Common situations: Named required fields in store/connection dialogs left empty; programmatic construction of options skipping a mandatory field; data migration leaving a field null.

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


AI-assisted analysis of xpipe-io/xpipe@d85ca821ba (2026-09-06). Data as JSON: /api/errors/dc62805b85ad0ecc. Report an issue: GitHub.