rathole-org/rathole · error

The feature ' ' is not compiled in this binary. Please…

Error message

The feature '{}' is not compiled in this binary. Please re-compile rathole

What it means

rathole is compiled with cargo feature flags (client, server, transports). This panic fires when code calls helper::feature_not_compile because the feature needed for the requested functionality was not enabled when the binary was built. It is a hard, unrecoverable panic indicating a build-time configuration problem, not a runtime failure.

Solutions

  1. Rebuild rathole with the required feature enabled, e.g. cargo build --release --features client (or server, or both)
  2. Install a full-feature build: cargo install rathole --features client,server
  3. Use a Docker image / release binary that includes the needed features
  4. Check available features in Cargo.toml and confirm with the binary's mode which one you need

Example fix

// before
cargo build --release --no-default-features --features server
// then running the binary as a client panics

// after
cargo build --release --no-default-features --features client,server
Defensive patterns

Strategy: validation

Validate before calling

// Check the binary was built with the needed feature before relying on runtime behavior.
// rathole exposes no runtime API for this; instead verify at deploy time:
// $ cargo metadata --no-deps --format-version 1 | jq '.packages[0].features'
// or simply test the binary's mode at startup in a wrapper script:
# if ! rathole --help | grep -q client; then echo 'build lacks client feature'; exit 1; fi

Prevention

When it happens

Trigger: Calling run_client or run_server paths when the corresponding cargo feature (e.g. "client" or "server") is absent, guarded by #[cfg(not(feature = ...))] before invoking feature_not_compile.

Common situations: Installing rathole via a package manager or Docker image built with a minimal feature set, then trying to run it in the other mode; building with --no-default-features but forgetting to re-add needed features; downloading a slim release binary.

Related errors


AI-assisted analysis of rathole-org/rathole@a292f7ed54 (2026-09-07). Data as JSON: /api/errors/454dd69ed3b33d54. Report an issue: GitHub.

Appendix: source

Thrown at src/helper.rs:40

    keepalive_interval: Duration,
) -> Result<()> {
    let s = SockRef::from(conn);
    let keepalive = TcpKeepalive::new()
        .with_time(keepalive_duration)
        .with_interval(keepalive_interval);

    trace!(
        "Set TCP keepalive {:?} {:?}",
        keepalive_duration,
        keepalive_interval
    );

    Ok(s.set_tcp_keepalive(&keepalive)?)
}

#[allow(dead_code)]
pub fn feature_not_compile(feature: &str) -> ! {
    panic!(
        "The feature '{}' is not compiled in this binary. Please re-compile rathole",
        feature
    )
}

#[allow(dead_code)]
pub fn feature_neither_compile(feature1: &str, feature2: &str) -> ! {
    panic!(
        "Neither of the feature '{}' or '{}' is compiled in this binary. Please re-compile rathole",
        feature1, feature2
    )
}

pub async fn to_socket_addr<A: ToSocketAddrs>(addr: A) -> Result<SocketAddr> {
    lookup_host(addr)
        .await?
        .next()
        .ok_or_else(|| anyhow!("Failed to lookup the host"))

View on GitHub (pinned to a292f7ed54)