moghtech/komodo · critical

Invalid ssl key file path.

Error message

Invalid ssl key file path.

What it means

In client/core/rs/src/entities/config/periphery.rs ssl_key_file, the configured SSL private key path (a PathBuf/OsString) is converted to a Rust String and the process panics via expect if the path is not valid UTF-8. The message 'Invalid ssl key file path.' therefore means the configured key path contains bytes that cannot be represented as a UTF-8 string.

Solutions

  1. Fix the configured ssl_key_file path so it is valid UTF-8 (rename the file, correct the config value).
  2. Inspect the raw bytes of the config value/env var (e.g. `printf %s "$KEY" | xxd`) to find invalid sequences.
  3. Regenerate or relocate the key under an ASCII/UTF-8 path (e.g. /etc/komodo/ssl/key.pem) and update config.
  4. If you control the code, use lossy conversion or PathBuf handling instead of panicking on into_string().

Example fix

// before
komodo_periphery: ssl_key_file = "/etc/ssl/cl??s/key.pem"  // non-UTF-8 bytes in path

// after
mv /etc/ssl/cl??s/key.pem /etc/ssl/komodo/key.pem
# config
ssl_key_file = "/etc/ssl/komodo/key.pem"
Defensive patterns

Strategy: validation

Validate before calling

fn assert_utf8_path(p: &std::path::Path) -> Result<(), String> {
    p.to_str().map(|_| ()).ok_or_else(|| format!("ssl_key_file path is not valid UTF-8: {:?}", p))
}

Type guard

fn is_utf8_path(p: &std::ffi::OsStr) -> bool { p.to_str().is_some() }

Try / catch

// expect() panics; guard at config load instead
let key = config.ssl_key_file();
if key.to_str().is_none() {
    return Err(format!("ssl_key_file is not valid UTF-8: {:?}", key));
}

Prevention

When it happens

Trigger: Starting Periphery with ssl_key_file set to a path containing non-UTF-8 characters (e.g. invalid byte sequences from locale/env issues or binary garbage); the path existing as valid UTF-8 does not matter here—only its encoding does.

Common situations: Paths built from environment variables or filenames with non-UTF-8 encodings (Windows-1252, Latin-1, etc.); copy-pasted config with hidden invalid bytes; container images with unusual locale settings.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of moghtech/komodo@780ac68b99 (2026-09-08). Data as JSON: /api/errors/9ea62e46b2678993. Report an issue: GitHub.

Appendix: source

Thrown at client/core/rs/src/entities/config/periphery.rs:674

}

impl mogh_server::ServerConfig for &PeripheryConfig {
  fn bind_ip(&self) -> &str {
    &self.bind_ip
  }
  fn port(&self) -> u16 {
    self.port
  }
  fn ssl_enabled(&self) -> bool {
    self.ssl_enabled
  }
  fn ssl_key_file(&self) -> &str {
    static SSL_KEY_FILE: OnceLock<String> = OnceLock::new();
    SSL_KEY_FILE.get_or_init(|| {
      PeripheryConfig::ssl_key_file(self)
        .into_os_string()
        .into_string()
        .expect("Invalid ssl key file path.")
    })
  }
  fn ssl_cert_file(&self) -> &str {
    static SSL_CERT_FILE: OnceLock<String> = OnceLock::new();
    SSL_CERT_FILE.get_or_init(|| {
      PeripheryConfig::ssl_cert_file(self)
        .into_os_string()
        .into_string()
        .expect("Invalid ssl cert file path.")
    })
  }
}

View on GitHub (pinned to 780ac68b99)