{"record":{"id":"df99ea6452aa9c3f","repo":"zeroclaw-labs/zeroclaw","slug":"the-openrc-log-writer-is-only-supported-on-linux","errorCode":null,"errorMessage":"the OpenRC log writer is only supported on Linux","messagePattern":"the OpenRC log writer is only supported on Linux","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/zeroclaw-runtime/src/service/mod.rs","lineNumber":162,"sourceCode":"        {\n            first_write_error = Some(error.context(format!(\n                \"Failed to write bounded service log {}\",\n                path.display()\n            )));\n            log = None;\n        }\n    }\n    if let Some(error) = first_write_error {\n        return Err(error);\n    }\n    Ok(())\n}\n\npub fn run_openrc_log_writer(stderr: bool) -> Result<()> {\n    #[cfg(not(target_os = \"linux\"))]\n    {\n        let _ = stderr;\n        bail!(\"the OpenRC log writer is only supported on Linux\")\n    }\n\n    #[cfg(target_os = \"linux\")]\n    {\n        drain_bounded_service_log(std::io::stdin().lock(), openrc_log_path(stderr))\n    }\n}\n\n#[cfg(any(target_os = \"linux\", test))]\nfn openrc_log_path(stderr: bool) -> &'static Path {\n    Path::new(if stderr {\n        OPENRC_STDERR_LOG\n    } else {\n        OPENRC_STDOUT_LOG\n    })\n}\n\n#[cfg(any(target_os = \"macos\", test))]","sourceCodeStart":144,"sourceCodeEnd":180,"githubUrl":"https://github.com/zeroclaw-labs/zeroclaw/blob/88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc/crates/zeroclaw-runtime/src/service/mod.rs#L144-L180","documentation":"run_openrc_log_writer is compiled as a stub on non-Linux targets that always bails (service/mod.rs:158-163). The OpenRC stdout/stderr log writer depends on Linux service log paths, so calling it on macOS or Windows can never succeed.","triggerScenarios":"Invoking the OpenRC log-writer entry point on a macOS or Windows build — e.g. running the same service CLI used on the Linux host on a dev machine, or a dispatcher that chose the wrong runner for the platform.","commonSituations":"One binary built once and deployed to all platforms; a wrapper script picks the OpenRC path by service name instead of OS; CI runs service smoke tests on a macOS runner.","solutions":["Gate the call: invoke run_openrc_log_writer only when std::env::consts::OS == \"linux\" (or via #[cfg(target_os = \"linux\")])","On macOS use the launchd runner (run_launchd_daemon) instead","Select the service runner from the detected OS, not from config alone"],"exampleFix":"// before\nrun_openrc_log_writer(stderr)?;\n\n// after\n#[cfg(target_os = \"linux\")]\nrun_openrc_log_writer(stderr)?;\n#[cfg(not(target_os = \"linux\"))]\nanyhow::bail!(\"openrc log writer requires Linux; this build targets {}\", std::env::consts::OS);","handlingStrategy":"validation","validationCode":"fn is_linux() -> bool {\n    std::env::consts::OS == \"linux\"\n}\n\nif is_linux() {\n    run_openrc_log_writer(stderr)?;\n} else {\n    tracing::warn!(os = std::env::consts::OS, \"skipping openrc log writer: Linux only\");\n}","typeGuard":"fn supports_openrc() -> bool { cfg!(target_os = \"linux\") }","tryCatchPattern":"If the call still fails, treat 'only supported on Linux' as a dispatcher bug: log the detected OS and the runner mismatch, and route to the platform-appropriate runner instead of retrying.","preventionTips":["Choose service runners from runtime OS detection, not config alone","Run service-command CI jobs on each supported OS","Document which runners are valid per platform"],"tags":["service","openrc","platform-support","linux","rust"],"backgroundTag":"unsupported-platform","analyzedSha":"88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc","analyzedAt":"2026-08-23T01:07:41.857Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}