tinyhumansai/openhuman · error

Failed to resolve executable directory

Error message

Failed to resolve executable directory

What it means

`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.

Source

Thrown at src/openhuman/platform/service/common.rs:27

use std::os::windows::process::CommandExt;

pub(crate) const SERVICE_LABEL: &str = "com.openhuman.core";
pub(crate) const LEGACY_SERVICE_LABEL: &str = "com.openhuman.daemon";
pub(crate) const LEGACY_APP_LABEL: &str = "com.openhuman.app";

pub(crate) fn resolve_daemon_executable() -> Result<PathBuf> {
    if let Ok(path) = std::env::var("OPENHUMAN_CORE_BIN") {
        let candidate = PathBuf::from(path);
        if candidate.exists() {
            return Ok(candidate);
        }
    }

    let exe = std::env::current_exe().context("Failed to resolve current executable")?;
    let exe_dir = exe
        .parent()
        .map(PathBuf::from)
        .ok_or_else(|| anyhow::anyhow!("Failed to resolve executable directory"))?;

    #[cfg(target_os = "macos")]
    let mut search_dirs = vec![
        exe_dir.clone(),
        exe_dir
            .parent()
            .map(|p| p.join("Resources"))
            .unwrap_or_else(|| exe_dir.clone()),
    ];
    #[cfg(not(target_os = "macos"))]
    let mut search_dirs = vec![exe_dir.clone()];

    for dir in search_dirs.drain(..) {
        let Ok(entries) = fs::read_dir(&dir) else {
            continue;
        };
        for entry in entries.flatten() {
            let path = entry.path();

View on GitHub (pinned to 7491200858)

Solutions

  1. Set `OPENHUMAN_CORE_BIN` to the executable's path — the helper checks it first and bypasses `current_exe` entirely
  2. Restart the binary from its real installed location rather than a deleted/moved path
  3. On Linux, verify `/proc/<pid>/exe` is readable; some hardened sandboxes block it
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at src/openhuman/platform/service/common.rs:27 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of tinyhumansai/openhuman@7491200858 (2026-08-17). Data as JSON: /api/errors/43e091f53eb8dbc3. Report an issue: GitHub.