xpipe-io/xpipe · error · IllegalArgumentException

Trimmed entry name is empty

Error message

Trimmed entry name is empty

What it means

StorePath.create(...) builds a store path from one or more name segments. The library throws this IllegalArgumentException when any provided name is null, whitespace-only, or otherwise empty after stripping, because a path segment cannot be blank. It keeps store paths from silently containing empty components that would break serialization and matching.

Source

Thrown at app/src/main/java/io/xpipe/app/util/StorePath.java:52

     * Creates a new store path.
     *
     * @throws IllegalArgumentException if any name is not valid
     */
    public static StorePath create(String... names) {
        if (names == null) {
            throw new IllegalArgumentException("Names are null");
        }

        if (Arrays.stream(names).anyMatch(s -> s == null)) {
            throw new IllegalArgumentException("Name is null");
        }

        if (Arrays.stream(names).anyMatch(s -> s.contains("" + SEPARATOR))) {
            throw new IllegalArgumentException("Separator character " + SEPARATOR + " is not allowed in the names");
        }

        if (Arrays.stream(names).anyMatch(s -> s.strip().length() == 0)) {
            throw new IllegalArgumentException("Trimmed entry name is empty");
        }

        return new StorePath(Arrays.stream(names).toList());
    }

    /**
     * Creates a new store path from a string representation.
     *
     * @param s the string representation, must be not null and fulfill certain requirements
     * @throws IllegalArgumentException if the string is not valid
     */
    public static StorePath fromString(String s) {
        if (s == null) {
            throw new IllegalArgumentException("String is null");
        }

        var split = s.split(String.valueOf(SEPARATOR), -1);

View on GitHub (pinned to d85ca821ba)

Solutions

  1. Trim and check each name before calling: if (name == null || name.strip().isEmpty()) skip or fail early.
  2. Filter out blank segments: Arrays.stream(rawNames).map(String::strip).filter(s -> !s.isEmpty()).toArray(String[]::new) and pass that.
  3. Make sure no name contains the SEPARATOR character, otherwise the adjacent separator check throws instead.

Example fix

// before
StorePath p = StorePath.create(userInput);
// after
if (userInput != null && !userInput.strip().isEmpty()) {
    StorePath p = StorePath.create(userInput.strip());
} else {
    throw new IllegalArgumentException("Store name required");
}
Defensive patterns

Strategy: validation

Validate before calling

public static boolean isValidName(String s) {
    return s != null && !s.strip().isEmpty() && s.indexOf(StorePath.SEPARATOR) < 0;
}

Try / catch

try {
    StorePath p = StorePath.create(name);
} catch (IllegalArgumentException e) {
    // handle blank or separator-containing name
}

Prevention

When it happens

Trigger: Calling StorePath.create(null), create(""), create(" "), or any varargs call where at least one name has strip().length() == 0.

Common situations: Passing user-entered store names straight into create() without trimming; a split/generation routine producing empty trailing segments; optional config fields left blank and forwarded as a name.

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/03f1fe4d5095535d. Report an issue: GitHub.