xpipe-io/xpipe · error · IllegalArgumentException

Name is null

Error message

Name is null

What it means

Generic argument-validation guard in the StorePath.create factory: it fires when any element of the supplied names vararg array is null. Store paths must consist entirely of valid, non-null name segments, so a null entry cannot be turned into a path; the caller must pass only non-null names (the array itself being null is caught separately by the preceding 'Names are null' check).

Source

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

    private final List<String> names;

    @JsonCreator
    public StorePath(List<String> names) {
        this.names = names;
    }

    /**
     * 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

View on GitHub (pinned to d85ca821ba)

Solutions

  1. Filter or default null entries before calling create: Arrays.stream(parts).filter(Objects::nonNull)
  2. Make optional name fields explicit (empty string is also rejected; use a real default)
  3. Validate the names list at config load time

Example fix

// before
StorePath.create("stores", maybeNullName);
// after
StorePath.create(Stream.of("stores", maybeNullName).filter(Objects::nonNull).toArray(String[]::new));
Defensive patterns

Strategy: validation

Validate before calling

List<String> safe = Arrays.stream(parts).filter(Objects::nonNull).collect(Collectors.toList());
if (safe.isEmpty()) throw new IllegalArgumentException("no names provided");
StorePath.create(safe.toArray(new String[0]));

Type guard

boolean allNonNull(String[] names) { return names != null && Arrays.stream(names).allMatch(Objects::nonNull); }

Try / catch

try {
    StorePath.create(parts);
} catch (IllegalArgumentException e) {
    logger.error("null name in store path: {}", e.getMessage());
}

Prevention

When it happens

Trigger: Passing a names array containing one or more null elements, e.g. new String[]{"group", null} or a list converted with toArray where an entry was absent.

Common situations: Optional name fields left null in store configuration; joining multiple sources of name parts where one part is missing.

Related errors


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