{"record":{"id":"7a2c2b7defe4e73e","repo":"neondatabase/neon","slug":"invalid-port-in-remote-endpoint","errorCode":null,"errorMessage":"Invalid port in {remote_endpoint}","messagePattern":"Invalid port in (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"compute_tools/src/rsyslog.rs","lineNumber":125,"sourceCode":"        && url.query().is_none()\n        && url.fragment().is_none()\n        && url.username() == \"\"\n        && url.password().is_none();\n\n    if !is_valid {\n        return Err(anyhow!(\n            \"Invalid address format {remote_endpoint}, expected host:port\"\n        ));\n    }\n    let host = match url.host() {\n        Some(Host::Domain(h)) if hostname_validator::is_valid(h) => h.to_string(),\n        Some(Host::Ipv4(ip4)) => ip4.to_string(),\n        Some(Host::Ipv6(ip6)) => ip6.to_string(),\n        _ => return Err(anyhow!(\"Invalid host\")),\n    };\n    let port = url\n        .port()\n        .ok_or_else(|| anyhow!(\"Invalid port in {remote_endpoint}\"))?;\n\n    Ok((host, port, tls))\n}\n\nfn generate_audit_rsyslog_config(\n    log_directory: String,\n    endpoint_id: &str,\n    project_id: &str,\n    remote_syslog_host: &str,\n    remote_syslog_port: u16,\n    remote_syslog_tls: &str,\n) -> String {\n    format!(\n        include_str!(\"config_template/compute_audit_rsyslog_template.conf\"),\n        log_directory = log_directory,\n        endpoint_id = endpoint_id,\n        project_id = project_id,\n        remote_syslog_host = remote_syslog_host,","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/neondatabase/neon/blob/8f60b04da47ffefe0e52bda2440134b42874eb75/compute_tools/src/rsyslog.rs#L107-L143","documentation":"url.port() returned None for the synthetic http:// URL, meaning no explicit port could be derived: either the endpoint omits ':port' entirely ('collector.host.tld') or the port digits are out of the u16 range so URL parsing did not produce a port ('collector.host.tld:90001'). Since http has no default port in url::Url's default-port table here, absence maps to this error rather than 80.","triggerScenarios":"host without port ('collector.host.tld'); port above 65535 or otherwise unparseable ('90001', '5t14'); IPv6 without brackets consuming colons so no port is recognized.","commonSituations":"Assuming a default syslog port (514) is implied; typos in 6-digit ports; unbracketed IPv6 addresses.","solutions":["Append an explicit port in 1..=65535, e.g. collector.host.tld:5555","Bracket IPv6 addresses so the trailing :port is unambiguous: [addr]:5555","Double-check for typos like 0-padding or extra digits"],"exampleFix":"# before\nAUDIT_LOGGING_ENDPOINT=collector.host.tld\n\n# after\nAUDIT_LOGGING_ENDPOINT=collector.host.tld:5555","handlingStrategy":"validation","validationCode":"// require an explicit, in-range port before configure_audit_rsyslog\nlet Some((_, port)) = endpoint.rsplit_once(':') else {\n    bail!(\"endpoint {endpoint:?} is missing an explicit :port\");\n};\nlet port: u16 = port.parse().map_err(|_| anyhow!(\"port out of range in {endpoint:?}\"))?;","typeGuard":"fn has_valid_port(endpoint: &str) -> bool {\n    endpoint\n        .rsplit_once(':')\n        .and_then(|(_, p)| p.parse::<u16>().ok())\n        .is_some()\n}","tryCatchPattern":"let port = url\n    .port()\n    .ok_or_else(|| anyhow!(\"Invalid port in {remote_endpoint}\"))?;","preventionTips":["Always configure an explicit port; never assume an implicit default","Bracket IPv6 addresses so the trailing :port parses","Range-check ports (1..=65535) where the value is entered"],"tags":["port","validation","host-port","rsyslog","rust"],"backgroundTag":"invalid-port-number","analyzedSha":"8f60b04da47ffefe0e52bda2440134b42874eb75","analyzedAt":"2026-08-16T23:39:28.135Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}