{"record":{"id":"a9469322807abe79","repo":"rathole-org/rathole","slug":"try-to-run-as-a-server-but-the-configuration-is-m","errorCode":null,"errorMessage":"Try to run as a server, but the configuration is missing. Please add the `[server]` block","messagePattern":"Try to run as a server, but the configuration is missing\\. Please add the `\\[server\\]` block","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/server.rs","lineNumber":50,"sourceCode":"\ntype ServiceDigest = protocol::Digest; // SHA256 of a service name\ntype Nonce = protocol::Digest; // Also called `session_key`\n\nconst TCP_POOL_SIZE: usize = 8; // The number of cached connections for TCP servies\nconst UDP_POOL_SIZE: usize = 2; // The number of cached connections for UDP services\nconst CHAN_SIZE: usize = 2048; // The capacity of various chans\nconst HANDSHAKE_TIMEOUT: u64 = 5; // Timeout for transport handshake\n\n// The entrypoint of running a server\npub async fn run_server(\n    config: Config,\n    shutdown_rx: broadcast::Receiver<bool>,\n    update_rx: mpsc::Receiver<ConfigChange>,\n) -> Result<()> {\n    let config = match config.server {\n            Some(config) => config,\n            None => {\n                return Err(anyhow!(\"Try to run as a server, but the configuration is missing. Please add the `[server]` block\"))\n            }\n        };\n\n    match config.transport.transport_type {\n        TransportType::Tcp => {\n            let mut server = Server::<TcpTransport>::from(config).await?;\n            server.run(shutdown_rx, update_rx).await?;\n        }\n        TransportType::Tls => {\n            #[cfg(any(feature = \"native-tls\", feature = \"rustls\"))]\n            {\n                let mut server = Server::<TlsTransport>::from(config).await?;\n                server.run(shutdown_rx, update_rx).await?;\n            }\n            #[cfg(not(any(feature = \"native-tls\", feature = \"rustls\")))]\n            crate::helper::feature_neither_compile(\"native-tls\", \"rustls\")\n        }\n        TransportType::Noise => {","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/rathole-org/rathole/blob/a292f7ed5402f840415fc6a53827da2f34337856/src/server.rs#L32-L68","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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)."],"exampleFix":"# before (config.toml)\n[client]\nremote_addr = \"example.com:443\"\n\n# after\n[server]\nbind_addr = \"0.0.0.0:443\"\n[transport]\ntype = \"tcp\"","handlingStrategy":"validation","validationCode":"let raw = std::fs::read_to_string(config_path)?;\nlet cfg: toml::Value = toml::from_str(&raw)?;\nif cfg.get(\"server\").is_none() {\n    anyhow::bail!(\"config file must contain a [server] block for server mode\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep separate client.toml and server.toml configs","Validate config against the expected schema at startup","Re-check config contents after upgrading versions"],"tags":["config","toml","server","missing-config"],"backgroundTag":"missing-required-config-field","analyzedSha":"a292f7ed5402f840415fc6a53827da2f34337856","analyzedAt":"2026-09-07T09:56:55.739Z","contentChangedAt":"2026-09-07T09:56:55.739Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}