rathole-org/rathole · error
Try to run as a server, but the configuration is missing…
Error message
Try to run as a server, but the configuration is missing. Please add the `[server]` block
What it means
run_server requires the `[server]` section of the TOML configuration to exist because it runs the instance in server mode. When the config has no `server` block, the code in src/server.rs:50 returns this descriptive error instead of a panic, telling the user to add the block.
Solutions
- Add a `[server]` section with the required settings (bind address, transport, etc.) to the config file.
- Double-check you are pointing the process at the correct config file (e.g. `--config server.toml`).
- Compare against the example server config in the repository/docs and add the missing keys.
- Verify the file parses as expected (no early `[server]` key swallowed by a wrong table).
Example fix
# before (config.toml) [client] remote_addr = "example.com:443" # after [server] bind_addr = "0.0.0.0:443" [transport] type = "tcp"
Defensive patterns
Strategy: validation
Validate before calling
let raw = std::fs::read_to_string(config_path)?;
let cfg: toml::Value = toml::from_str(&raw)?;
if cfg.get("server").is_none() {
anyhow::bail!("config file must contain a [server] block for server mode");
} Prevention
- Keep separate client.toml and server.toml configs
- Validate config against the expected schema at startup
- Re-check config contents after upgrading versions
When it happens
Trigger: Starting the binary with server role flags (e.g. `--server`) or an entry point that calls run_instance → run_server while the loaded config file lacks a `[server]` section.
Common situations: Using a client-oriented config file for a server deployment; a config file that got truncated or merged incorrectly; copying a minimal client example config and enabling server mode; older configs predating the `[server]` block after a version upgrade.
Understand the failure class
Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.
Related errors
- Missing tls config
- Missing websocket config
- Neither of `[server]` or `[client]` is defined
- Unknown proxy scheme
- Missing TLS configuration
AI-assisted analysis of rathole-org/rathole@a292f7ed54 (2026-09-07).
Data as JSON: /api/errors/a9469322807abe79.
Report an issue: GitHub.
Appendix: source
Thrown at src/server.rs:50
type ServiceDigest = protocol::Digest; // SHA256 of a service name
type Nonce = protocol::Digest; // Also called `session_key`
const TCP_POOL_SIZE: usize = 8; // The number of cached connections for TCP servies
const UDP_POOL_SIZE: usize = 2; // The number of cached connections for UDP services
const CHAN_SIZE: usize = 2048; // The capacity of various chans
const HANDSHAKE_TIMEOUT: u64 = 5; // Timeout for transport handshake
// The entrypoint of running a server
pub async fn run_server(
config: Config,
shutdown_rx: broadcast::Receiver<bool>,
update_rx: mpsc::Receiver<ConfigChange>,
) -> Result<()> {
let config = match config.server {
Some(config) => config,
None => {
return Err(anyhow!("Try to run as a server, but the configuration is missing. Please add the `[server]` block"))
}
};
match config.transport.transport_type {
TransportType::Tcp => {
let mut server = Server::<TcpTransport>::from(config).await?;
server.run(shutdown_rx, update_rx).await?;
}
TransportType::Tls => {
#[cfg(any(feature = "native-tls", feature = "rustls"))]
{
let mut server = Server::<TlsTransport>::from(config).await?;
server.run(shutdown_rx, update_rx).await?;
}
#[cfg(not(any(feature = "native-tls", feature = "rustls")))]
crate::helper::feature_neither_compile("native-tls", "rustls")
}
TransportType::Noise => {View on GitHub (pinned to a292f7ed54)