yuliskov/SmartTube · error · IllegalArgumentException

hostname can't be null

Error message

hostname can't be null

What it means

checkHost runs inside PasswdInetSocketAddress.createUnresolved before the address is built: the hostname must be non-null (empty is accepted, mirroring InetSocketAddress.createUnresolved). The throw means the host part of the proxy address never made it into the call — credentials-only input, an '@' with nothing after it, or a parser that returns null on garbage.

Source

Thrown at common/src/main/java/com/liskovsoft/smartyoutubetv2/common/proxy/PasswdInetSocketAddress.java:48

    }

    public String getUsername() {
        return mUsername;
    }

    public String getPassword() {
        return mPassword;
    }

    private static int checkPort(int port) {
        if (port < 0 || port > 0xFFFF)
            throw new IllegalArgumentException("port out of range:" + port);
        return port;
    }

    private static String checkHost(String hostname) {
        if (hostname == null)
            throw new IllegalArgumentException("hostname can't be null");
        return hostname;
    }
}

View on GitHub (pinned to 3de8d90593)

Solutions

  1. Require the host in the proxy settings UI and validate non-empty before creating the address
  2. Fix the string parsing so a missing host produces a user-facing error rather than a null
  3. Trim input and reject blanks early

Example fix

// before
PasswdInetSocketAddress.createUnresolved(host /* null when regex missed */, port, user, pass);

// after
if (host == null || host.trim().isEmpty()) throw new IllegalArgumentException("Proxy host required");
PasswdInetSocketAddress.createUnresolved(host.trim(), port, user, pass);
Defensive patterns

Strategy: validation

Validate before calling

if (host == null || host.trim().isEmpty()) {
    throw new IllegalArgumentException("Proxy host is required");
}
PasswdInetSocketAddress.createUnresolved(host.trim(), port, user, pass);

Type guard

static boolean hasHost(@Nullable String host) {
    return host != null && !host.trim().isEmpty();
}

Prevention

When it happens

Trigger: Proxy input like 'user:pass@' or 'user:pass' with no host segment; a parsing step that splits incorrectly and assigns null to host before calling createUnresolved.

Common situations: Users pasting credentials without the host; malformed proxy strings from settings where the host field was left blank; regex-based extraction failing to match and defaulting to null.

Related errors


AI-assisted analysis of yuliskov/SmartTube@3de8d90593 (2026-08-22). Data as JSON: /api/errors/ba94d6a3f11ce040. Report an issue: GitHub.