rustdesk/rustdesk · error
Invalid server address: {}
Error message
Invalid server address: {} What it means
create_online_stream splits the configured rendezvous server address on ':' and requires exactly host:port. If the address has no colon, multiple colons (IPv6 literal), or is empty, this bail fires. The library throws it to fail fast instead of panicking on the tmp[1] index later.
Source
Thrown at src/client.rs:5214
} else {
let query_timeout = std::time::Duration::from_millis(3_000);
match query_online_states_(&ids, query_timeout).await {
Ok((onlines, offlines)) => {
f(onlines, offlines);
}
Err(e) => {
log::debug!("query onlines, {}", &e);
}
}
}
}
async fn create_online_stream() -> ResultType<Stream> {
let (rendezvous_server, _servers, _contained) =
crate::get_rendezvous_server(READ_TIMEOUT).await;
let tmp: Vec<&str> = rendezvous_server.split(":").collect();
if tmp.len() != 2 {
bail!("Invalid server address: {}", rendezvous_server);
}
let port: u16 = tmp[1].parse()?;
if port == 0 {
bail!("Invalid server address: {}", rendezvous_server);
}
let online_server = format!("{}:{}", tmp[0], port - 1);
connect_tcp(online_server, CONNECT_TIMEOUT).await
}
async fn query_online_states_(
ids: &Vec<String>,
timeout: std::time::Duration,
) -> ResultType<(Vec<String>, Vec<String>)> {
let mut msg_out = RendezvousMessage::new();
msg_out.set_online_request(OnlineRequest {
id: Config::get_id(),
peers: ids.clone(),
..Default::default()View on GitHub (pinned to 91c9fccbb0)
Solutions
- Set the rendezvous server to a valid 'host:port' pair (e.g. 'rs-ny.example.com:21116') in the client config.
- If using IPv6, wrap the address in brackets: '[2001:db8::1]:21116'.
- Check env/config overrides (RENDEZVOUS_SERVERS / custom server settings) for stray characters, spaces, or extra colons.
- Log rendezvous_server at this point to see the offending value before fixing config.
Example fix
// config before rendezvous_server = "rs-ny.example.com" // after rendezvous_server = "rs-ny.example.com:21116"
Defensive patterns
Strategy: validation
Validate before calling
fn is_valid_rendezvous_addr(addr: &str) -> bool {
match addr.rsplit_once(':') {
Some((host, port)) => !host.is_empty() && port.parse::<u16>().map(|p| p > 0).unwrap_or(false),
None => false,
}
} Try / catch
match create_online_stream().await {
Ok(s) => s,
Err(e) if e.to_string().contains("Invalid server address") => {
eprintln!("fix rendezvous server config, got: {}", cfg.rendezvous_server);
return Err(e);
}
Err(e) => return Err(e),
} Prevention
- Validate the rendezvous server string (host:port) at config load time
- Always specify an explicit non-zero port; use brackets for IPv6 literals
- Add a unit test over server config parsing
When it happens
Trigger: Calling create_online_stream (via query_online_states) when the rendezvous_server string returned by get_rendezvous_server is not of the form 'host:port' — e.g. 'rs-ny.rustdesk.com' without a port, 'host:8000:extra', or an unbracketed IPv6 literal '::1'.
Common situations: Custom rendezvous-server configured without a port in the client config; config value corrupted or truncated; IPv6 server address entered without square brackets; environment override (RENDEZVOUS_SERVERS) with malformed entries.
Understand the failure class
Background: "Invalid URL" errors: why new URL(), URI.parse, and reqwest::Url reject your string — missing scheme, whitespace, and bad path format — this error's family across 39 libraries.
Related errors
- decrypt_vec_or_original telegram bot token failed
- Thread panicked
- {} (serde_json parse error)
- Incoming only mode
- Failed to secure tcp: {}
AI-assisted analysis of rustdesk/rustdesk@91c9fccbb0 (2026-09-10).
Data as JSON: /api/errors/4af7d468c6dc78ae.
Report an issue: GitHub.