{"record":{"id":"43e091f53eb8dbc3","repo":"tinyhumansai/openhuman","slug":"failed-to-resolve-executable-directory","errorCode":null,"errorMessage":"Failed to resolve executable directory","messagePattern":"Failed to resolve executable directory","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/openhuman/platform/service/common.rs","lineNumber":27,"sourceCode":"use std::os::windows::process::CommandExt;\n\npub(crate) const SERVICE_LABEL: &str = \"com.openhuman.core\";\npub(crate) const LEGACY_SERVICE_LABEL: &str = \"com.openhuman.daemon\";\npub(crate) const LEGACY_APP_LABEL: &str = \"com.openhuman.app\";\n\npub(crate) fn resolve_daemon_executable() -> Result<PathBuf> {\n    if let Ok(path) = std::env::var(\"OPENHUMAN_CORE_BIN\") {\n        let candidate = PathBuf::from(path);\n        if candidate.exists() {\n            return Ok(candidate);\n        }\n    }\n\n    let exe = std::env::current_exe().context(\"Failed to resolve current executable\")?;\n    let exe_dir = exe\n        .parent()\n        .map(PathBuf::from)\n        .ok_or_else(|| anyhow::anyhow!(\"Failed to resolve executable directory\"))?;\n\n    #[cfg(target_os = \"macos\")]\n    let mut search_dirs = vec![\n        exe_dir.clone(),\n        exe_dir\n            .parent()\n            .map(|p| p.join(\"Resources\"))\n            .unwrap_or_else(|| exe_dir.clone()),\n    ];\n    #[cfg(not(target_os = \"macos\"))]\n    let mut search_dirs = vec![exe_dir.clone()];\n\n    for dir in search_dirs.drain(..) {\n        let Ok(entries) = fs::read_dir(&dir) else {\n            continue;\n        };\n        for entry in entries.flatten() {\n            let path = entry.path();","sourceCodeStart":9,"sourceCodeEnd":45,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/src/openhuman/platform/service/common.rs#L9-L45","documentation":"`std::env::current_exe()` failed inside `resolve_daemon_executable`, the platform service helper that locates the core binary for launchd/Windows service registration. This fires when the process's own executable path cannot be determined — the binary was deleted or replaced while running, `/proc` is unavailable on Linux, or the process runs in an environment that hides the exe path. The daemon-executable resolution cannot proceed without it.","triggerScenarios":"Thrown at src/openhuman/platform/service/common.rs:27 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set `OPENHUMAN_CORE_BIN` to the executable's path — the helper checks it first and bypasses `current_exe` entirely","Restart the binary from its real installed location rather than a deleted/moved path","On Linux, verify `/proc/<pid>/exe` is readable; some hardened sandboxes block it"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"749120085864ce16e0f273c7b86fac7740b39c5b","analyzedAt":"2026-08-17T21:21:45.363Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}