{"record":{"id":"89939b9612a38e14","repo":"rathole-org/rathole","slug":"neither-of-the-feature-or-is-compiled-in","errorCode":null,"errorMessage":"Neither of the feature '{}' or '{}' is compiled in this binary. Please re-compile rathole","messagePattern":"Neither of the feature '(.+?)' or '(.+?)' is compiled in this binary\\. Please re-compile rathole","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/helper.rs","lineNumber":48,"sourceCode":"        \"Set TCP keepalive {:?} {:?}\",\n        keepalive_duration,\n        keepalive_interval\n    );\n\n    Ok(s.set_tcp_keepalive(&keepalive)?)\n}\n\n#[allow(dead_code)]\npub fn feature_not_compile(feature: &str) -> ! {\n    panic!(\n        \"The feature '{}' is not compiled in this binary. Please re-compile rathole\",\n        feature\n    )\n}\n\n#[allow(dead_code)]\npub fn feature_neither_compile(feature1: &str, feature2: &str) -> ! {\n    panic!(\n        \"Neither of the feature '{}' or '{}' is compiled in this binary. Please re-compile rathole\",\n        feature1, feature2\n    )\n}\n\npub async fn to_socket_addr<A: ToSocketAddrs>(addr: A) -> Result<SocketAddr> {\n    lookup_host(addr)\n        .await?\n        .next()\n        .ok_or_else(|| anyhow!(\"Failed to lookup the host\"))\n}\n\npub fn host_port_pair(s: &str) -> Result<(&str, u16)> {\n    let semi = s.rfind(':').expect(\"missing semicolon\");\n    Ok((&s[..semi], s[semi + 1..].parse()?))\n}\n\n/// Create a UDP socket and connect to `addr`","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/rathole-org/rathole/blob/a292f7ed5402f840415fc6a53827da2f34337856/src/helper.rs#L30-L66","documentation":"Variant of feature_not_compile: fires when code requires at least one of two features (commonly \"client\" OR \"server\") but neither was compiled into the binary. It panics because the requested functionality does not exist in this build. This is a build-configuration problem, not a runtime bug.","triggerScenarios":"Invoking a code path guarded by #[cfg(not(feature = \"f1\"))] #[cfg(not(feature = \"f2\"))] that calls feature_neither_compile — e.g. running the binary without either the client or server feature enabled.","commonSituations":"Building with --no-default-features and forgetting to add client or server; producing a transport-only or test build and then trying to run it as a proxy.","solutions":["Rebuild with at least one mode feature: cargo build --release --features client (or server, or client,server)","Install the default build: cargo install rathole (includes client and server)","Verify the built binary's features match the mode you run it in"],"exampleFix":"// before\ncargo build --release --no-default-features --features tls\n// running rathole panics: neither client nor server compiled\n\n// after\ncargo build --release --no-default-features --features tls,client,server","handlingStrategy":"validation","validationCode":"// Ensure at least one of the mode features is enabled at build time:\n// In a build.rs or CI check:\n// let feats = std::env::var(\"CARGO_FEATURE_CLIENT\").is_ok() || std::env::var(\"CARGO_FEATURE_SERVER\").is_ok();\n// assert!(feats, \"build must enable client or server\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never build with --no-default-features without re-adding client or server","Add a CI check that the produced binary can start in the intended mode"],"tags":["rust","compile-time","feature-flags","build-configuration"],"backgroundTag":"feature-not-enabled","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"}