yuliskov/SmartTube · error · IllegalArgumentException
port out of range:${port}
Error message
port out of range:${port} What it means
PasswdInetSocketAddress.createUnresolved validates exactly like java.net.InetSocketAddress: the port must fall in 0..65535, and the offending value is interpolated into the message. -1 is the classic culprit because proxy-string parsing in this codebase degrades a missing or unparsable port to -1 before the check runs.
Source
Thrown at common/src/main/java/com/liskovsoft/smartyoutubetv2/common/proxy/PasswdInetSocketAddress.java:42
public String getHostString() {
return mInetSocketAddress.getHostString();
}
public int getPort() {
return mInetSocketAddress.getPort();
}
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
- Require an explicit port in the proxy settings UI and validate 1..65535 before creating the address
- Fix the parsing path so a missing port gets a sensible default (e.g. 3128) or a user-facing error, never -1
- Reject out-of-range input early with a clear message instead of letting the constructor throw
Example fix
// before
int port = parts.length > 1 ? Integer.parseInt(parts[1]) : -1;
PasswdInetSocketAddress.createUnresolved(host, port, user, pass);
// after
int port = parts.length > 1 ? Integer.parseInt(parts[1].trim()) : 3128;
if (port < 0 || port > 0xFFFF) throw new IllegalArgumentException("Bad proxy port: " + port);
PasswdInetSocketAddress.createUnresolved(host, port, user, pass); Defensive patterns
Strategy: validation
Validate before calling
if (port < 0 || port > 0xFFFF) {
throw new IllegalArgumentException("Proxy port out of range: " + port);
}
PasswdInetSocketAddress.createUnresolved(host, port, user, pass); Type guard
static boolean isValidPort(int port) {
return port >= 0 && port <= 0xFFFF;
} Prevention
- Validate the proxy port field (1..65535) in the UI before saving
- Default missing ports to a known value (e.g. 3128), never -1
- Parse port digits defensively: trim and catch NumberFormatException
When it happens
Trigger: A proxy spec without a port (user:pass@host) where the parser stored -1; a typed port above 65535 such as 70000; malformed digits like '8080x' parsed to -1 and then passed to createUnresolved.
Common situations: Users entering a proxy host without a port in settings; clipboard-imported proxy strings missing the port segment; port field overflow past 65535.
Related errors
- hostname can't be null
- content type must be greater or less than '0'!
- type ${type} is not compatible with address ${sa}
AI-assisted analysis of yuliskov/SmartTube@3de8d90593 (2026-08-22).
Data as JSON: /api/errors/d81f65b97b2dbfd3.
Report an issue: GitHub.