{"record":{"id":"9ea62e46b2678993","repo":"moghtech/komodo","slug":"invalid-ssl-key-file-path","errorCode":null,"errorMessage":"Invalid ssl key file path.","messagePattern":"Invalid ssl key file path\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"client/core/rs/src/entities/config/periphery.rs","lineNumber":674,"sourceCode":"}\n\nimpl mogh_server::ServerConfig for &PeripheryConfig {\n  fn bind_ip(&self) -> &str {\n    &self.bind_ip\n  }\n  fn port(&self) -> u16 {\n    self.port\n  }\n  fn ssl_enabled(&self) -> bool {\n    self.ssl_enabled\n  }\n  fn ssl_key_file(&self) -> &str {\n    static SSL_KEY_FILE: OnceLock<String> = OnceLock::new();\n    SSL_KEY_FILE.get_or_init(|| {\n      PeripheryConfig::ssl_key_file(self)\n        .into_os_string()\n        .into_string()\n        .expect(\"Invalid ssl key file path.\")\n    })\n  }\n  fn ssl_cert_file(&self) -> &str {\n    static SSL_CERT_FILE: OnceLock<String> = OnceLock::new();\n    SSL_CERT_FILE.get_or_init(|| {\n      PeripheryConfig::ssl_cert_file(self)\n        .into_os_string()\n        .into_string()\n        .expect(\"Invalid ssl cert file path.\")\n    })\n  }\n}\n","sourceCodeStart":656,"sourceCodeEnd":687,"githubUrl":"https://github.com/moghtech/komodo/blob/780ac68b992094a9fccd5fffb760e0c84fd3c3d1/client/core/rs/src/entities/config/periphery.rs#L656-L687","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Fix the configured ssl_key_file path so it is valid UTF-8 (rename the file, correct the config value).","Inspect the raw bytes of the config value/env var (e.g. `printf %s \"$KEY\" | xxd`) to find invalid sequences.","Regenerate or relocate the key under an ASCII/UTF-8 path (e.g. /etc/komodo/ssl/key.pem) and update config.","If you control the code, use lossy conversion or PathBuf handling instead of panicking on into_string()."],"exampleFix":"// before\nkomodo_periphery: ssl_key_file = \"/etc/ssl/cl??s/key.pem\"  // non-UTF-8 bytes in path\n\n// after\nmv /etc/ssl/cl??s/key.pem /etc/ssl/komodo/key.pem\n# config\nssl_key_file = \"/etc/ssl/komodo/key.pem\"","handlingStrategy":"validation","validationCode":"fn assert_utf8_path(p: &std::path::Path) -> Result<(), String> {\n    p.to_str().map(|_| ()).ok_or_else(|| format!(\"ssl_key_file path is not valid UTF-8: {:?}\", p))\n}","typeGuard":"fn is_utf8_path(p: &std::ffi::OsStr) -> bool { p.to_str().is_some() }","tryCatchPattern":"// expect() panics; guard at config load instead\nlet key = config.ssl_key_file();\nif key.to_str().is_none() {\n    return Err(format!(\"ssl_key_file is not valid UTF-8: {:?}\", key));\n}","preventionTips":["Validate all configured paths are valid UTF-8 at startup, before first use.","Keep cert/key files under plain-ASCII directories (e.g. /etc/komodo/ssl/).","Avoid building paths from unchecked environment variables or user-supplied names.","Prefer Result-returning accessors over expect()/unwrap() for config values."],"tags":["ssl","tls","config","utf-8","panic","rust"],"backgroundTag":"invalid-config-value","analyzedSha":"780ac68b992094a9fccd5fffb760e0c84fd3c3d1","analyzedAt":"2026-09-08T10:02:44.861Z","contentChangedAt":"2026-09-08T10:02:44.861Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}