tinyhumansai/openhuman · error
Service management is supported on macOS, Linux, and Windows
Error message
Service management is supported on macOS, Linux, and Windows only
What it means
platform::service::install registers the background service per OS (launchd on macOS, systemd on Linux, the Windows service manager); every platform arm is #[cfg]-gated, and on any other target the trailing cfg(not(any(macos, linux, windows))) arm compiles to this bail. A runtime mock (OPENHUMAN_SERVICE_MOCK) short-circuits before the platform arms, which is the sanctioned way to exercise install in tests on any OS.
Source
Thrown at src/openhuman/platform/service/core.rs:49
}
#[cfg(target_os = "macos")]
{
macos::install(config)?;
status(config)
}
#[cfg(target_os = "linux")]
{
linux::install(config)?;
status(config)
}
#[cfg(windows)]
{
windows::install(config)?;
status(config)
}
#[cfg(not(any(target_os = "macos", target_os = "linux", windows)))]
anyhow::bail!("Service management is supported on macOS, Linux, and Windows only")
}
pub fn start(config: &Config) -> Result<ServiceStatus> {
if super::mock::is_enabled() {
return super::mock::start(config);
}
#[cfg(target_os = "macos")]
return macos::start(config);
#[cfg(target_os = "linux")]
return linux::start(config);
#[cfg(windows)]
return windows::start(config);
#[cfg(not(any(target_os = "macos", target_os = "linux", windows)))]
anyhow::bail!("Service management is supported on macOS, Linux, and Windows only")
}
pub fn stop(config: &Config) -> Result<ServiceStatus> {View on GitHub (pinned to 7491200858)
Solutions
- Run service management only on the supported desktop OSes; gate callers with a cfg or runtime OS check.
- For tests on any platform, set OPENHUMAN_SERVICE_MOCK=1 (optionally OPENHUMAN_SERVICE_MOCK_STATE_FILE) to route install to the in-memory mock.
- For a genuine port, implement a platform module behind a new cfg arm rather than calling the stub.
Example fix
// before (running on an unsupported target)
service::install(&config)?; // bails
// after — tests on any OS: route to the mock
std::env::set_var("OPENHUMAN_SERVICE_MOCK", "1");
service::install(&config)?; Defensive patterns
Strategy: validation
Validate before calling
fn service_management_supported() -> bool {
matches!(std::env::consts::OS, "macos" | "linux" | "windows")
} Try / catch
Catch the bail and translate it to a UI 'not supported on this platform' notice; for tests, the OPENHUMAN_SERVICE_MOCK env var is the sanctioned way to exercise install on any OS.
Prevention
- Expose service controls only on supported OSes.
- Use OPENHUMAN_SERVICE_MOCK=1 (and OPENHUMAN_SERVICE_MOCK_STATE_FILE) for CI/tests on any platform.
- Remember every service operation carries the same trailing bail when adding new call sites.
When it happens
Trigger: Compiling or running the service-install path on a non-macOS/Linux/Windows target — BSD, Android, wasm — e.g. cross-compiled CI binaries or porting efforts, without the mock env var set.
Common situations: Cross-compilation checks; ports to exotic targets; test binaries built for unusual targets where the author forgot the mock switch.
Understand the failure class
Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.
Related errors
- proc_metrics::sample_self supports Linux and macOS (this is
- proc_metrics::sample_tree supports Linux and macOS (this is
- secret request {} cancelled before user submit
- secret request {} timed out after {}s
- command failed with status {status}
AI-assisted analysis of tinyhumansai/openhuman@7491200858 (2026-08-17).
Data as JSON: /api/errors/f82ec259133717b2.
Report an issue: GitHub.