apache/shardingsphere · critical · IllegalArgumentException

Invalid path `%s`.

Error message

Invalid path `%s`.

What it means

IllegalArgumentException ('Invalid path `%s`.') thrown by BootstrapArguments.isValidPath while parsing the third bootstrap argument. Each comma-separated entry in args[2] is tested with InetAddresses.isInetAddress; non-IP entries are treated as Unix socket paths and validated with Paths.get(path) — an InvalidPathException (illegal characters, NUL byte, malformed path on the OS) is caught and rethrown as this exception.

Source

Thrown at proxy/bootstrap/src/main/java/org/apache/shardingsphere/proxy/arguments/BootstrapArguments.java:113

    
    /**
     * Get unix domain socket path.
     *
     * @return socket path
     */
    public Optional<String> getSocketPath() {
        if (args.length < 3) {
            return Optional.empty();
        }
        List<String> addresses = Arrays.asList(args[2].split(","));
        return addresses.stream().filter(address -> !InetAddresses.isInetAddress(address)).filter(this::isValidPath).findFirst();
    }
    
    private boolean isValidPath(final String path) {
        try {
            Paths.get(path);
        } catch (final InvalidPathException ignored) {
            throw new IllegalArgumentException(String.format("Invalid path `%s`.", path));
        }
        return true;
    }
}

View on GitHub (pinned to e952770a21)

Solutions

  1. Provide the third argument as comma-separated values where each is either a literal IP address or a syntactically valid absolute socket path for the host OS
  2. Remove invalid characters/control bytes from generated startup scripts; retype the argument rather than pasting from formatted docs
  3. If you do not need address/socket overrides, omit the third argument entirely (fewer than 3 args returns Optional.empty())

Example fix

# before
java -jar shardingsphere-proxy-bootstrap.jar 3307 conf/server.yaml '127.0.0.1, “/tmp/ss.sock”'

# after
java -jar shardingsphere-proxy-bootstrap.jar 3307 conf/server.yaml 127.0.0.1,/tmp/ss.sock
Defensive patterns

Strategy: validation

Validate before calling

// validate each comma-separated entry before launch
for (String entry : addressArg.split(",")) {
    String e = entry.trim();
    boolean ip = InetAddresses.isInetAddress(e);
    boolean path;
    try { Paths.get(e); path = true; } catch (final InvalidPathException ex) { path = false; }
    if (!ip && !path) { throw new IllegalArgumentException("Bad address/socket entry: " + e); }
}

Prevention

When it happens

Trigger: Starting the proxy with a third argument whose non-address component is not a legal filesystem path on the platform, e.g. `java -jar proxy.jar 3307 server.yaml 'badpath'` or a path with characters invalid on the OS; valid examples are IPs (`127.0.0.1`) or socket paths (`/tmp/ss.sock`).

Common situations: Copy-pasting bind-address lists with smart quotes or template placeholders; passing Windows-style paths on Linux or vice versa; stray whitespace/control characters in generated start scripts.

Related errors


AI-assisted analysis of apache/shardingsphere@e952770a21 (2026-08-14). Data as JSON: /api/errors/312a351f84a35a2f. Report an issue: GitHub.