rathole-org/rathole · error

Missing noise config

Error message

Missing noise config

What it means

The noise-protocol transport requires a `[transport.noise]` section containing at least the handshake pattern and optionally a remote public key. When `config.noise` is None, the constructor in src/transport/noise.rs:45 returns this error. Without noise parameters the encrypted transport cannot build its handshake Builder.

Solutions

  1. Add a `[transport.noise]` section to the config with `pattern` (e.g. "Noise_XK_25519_ChaChaPoly_BLAKE2") and `remote_public_key` for the client.
  2. Generate noise keys if you have none and place the local private key and peer's public key in the respective configs.
  3. If you don't want encryption, switch transport type back to plain tcp instead of noise.
  4. Cross-check key configuration against the repository's example configs (server needs its keypair; client needs server's public key).

Example fix

# before
[transport]
type = "noise"

# after
[transport]
type = "noise"
[transport.noise]
pattern = "Noise_XK_25519_ChaChaPoly_BLAKE2"
remote_public_key = "base64-encoded-server-public-key"
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("transport").and_then(|t| t.get("noise")).is_none() {
    anyhow::bail!("noise transport selected but [transport.noise] is missing");
}

Prevention

When it happens

Trigger: Choosing the noise transport while the config lacks the noise section, so `match &config.noise` falls to the None arm and returns Err.

Common situations: Copying a TCP-only config and switching transport type to noise without adding keys; forgetting to share/copy the remote public key section after generating a local keypair; config merge tooling dropping the noise block.

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


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

Appendix: source

Thrown at src/transport/noise.rs:45

        match &self.remote_public_key {
            Some(x) => builder.remote_public_key(x),
            None => builder,
        }
    }
}

#[async_trait]
impl Transport for NoiseTransport {
    type Acceptor = TcpListener;
    type RawStream = TcpStream;
    type Stream = snowstorm::stream::NoiseStream<TcpStream>;

    fn new(config: &TransportConfig) -> Result<Self> {
        let tcp = TcpTransport::new(config)?;

        let config = match &config.noise {
            Some(v) => v.clone(),
            None => return Err(anyhow!("Missing noise config")),
        };
        let builder = Builder::new(config.pattern.parse()?);

        let remote_public_key = match &config.remote_public_key {
            Some(x) => {
                Some(base64::decode(x).with_context(|| "Failed to decode remote_public_key")?)
            }
            None => None,
        };

        let local_private_key = match &config.local_private_key {
            Some(x) => base64::decode(x.as_bytes())
                .with_context(|| "Failed to decode local_private_key")?,
            None => builder.generate_keypair()?.private,
        };

        let params: NoiseParams = config.pattern.parse()?;

View on GitHub (pinned to a292f7ed54)