{"record":{"id":"6a5d300241d522f7","repo":"zeroclaw-labs/zeroclaw","slug":"unknown-init-system-supported-auto-system","errorCode":null,"errorMessage":"Unknown init system: '{}'. Supported: auto, systemd, openrc","messagePattern":"Unknown init system: '(.+?)'\\. Supported: auto, systemd, openrc","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/zeroclaw-runtime/src/service/mod.rs","lineNumber":541,"sourceCode":"pub enum InitSystem {\n    /// Auto-detect based on system indicators\n    #[default]\n    Auto,\n    /// systemd (via systemctl --user)\n    Systemd,\n    /// OpenRC (via rc-service)\n    Openrc,\n}\n\nimpl FromStr for InitSystem {\n    type Err = anyhow::Error;\n\n    fn from_str(s: &str) -> Result<Self> {\n        match s.to_lowercase().as_str() {\n            \"auto\" => Ok(Self::Auto),\n            \"systemd\" => Ok(Self::Systemd),\n            \"openrc\" => Ok(Self::Openrc),\n            other => bail!(\n                \"Unknown init system: '{}'. Supported: auto, systemd, openrc\",\n                other\n            ),\n        }\n    }\n}\n\nimpl InitSystem {\n    #[cfg(target_os = \"linux\")]\n    pub fn resolve(self) -> Result<Self> {\n        match self {\n            Self::Auto => detect_init_system(),\n            concrete => Ok(concrete),\n        }\n    }\n\n    #[cfg(not(target_os = \"linux\"))]\n    pub fn resolve(self) -> Result<Self> {","sourceCodeStart":523,"sourceCodeEnd":559,"githubUrl":"https://github.com/zeroclaw-labs/zeroclaw/blob/88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc/crates/zeroclaw-runtime/src/service/mod.rs#L523-L559","documentation":"InitSystem implements FromStr to parse the --service-init flag. Only 'auto', 'systemd' and 'openrc' (case-insensitive via to_lowercase) are accepted; any other string bails with this message. Surrounding whitespace is not trimmed, so ' systemd' or a value ending in a newline also fails.","triggerScenarios":"Passing --service-init a typo or unsupported value such as 'launchd', 'sysvinit', 'upstart', 'SystemD ' (trailing space), or a value read from a config file / env var / script variable that carries whitespace or a newline.","commonSituations":"Wrapper scripts or CI templates that hardcode an init name borrowed from another tool; assuming macOS launchd is a selectable init; piping values into the flag without trimming.","solutions":["Use exactly one of: auto, systemd, openrc (no surrounding whitespace)","Trim the value before passing it: zeroclaw service install --service-init \"$VALUE\".trim()","On macOS omit the flag entirely and let auto resolve"],"exampleFix":"// before\nlet init = InitSystem::from_str(&arg)?; // fails on \" systemd\\n\"\n\n// after\nlet init = InitSystem::from_str(arg.trim())?;","handlingStrategy":"validation","validationCode":"fn is_valid_init_system(value: &str) -> bool {\n    matches!(value.trim().to_lowercase().as_str(), \"auto\" | \"systemd\" | \"openrc\")\n}","typeGuard":"fn parse_init_system(value: &str) -> Option<InitSystem> {\n    match value.trim().to_lowercase().as_str() {\n        \"auto\" => Some(InitSystem::Auto),\n        \"systemd\" => Some(InitSystem::Systemd),\n        \"openrc\" => Some(InitSystem::Openrc),\n        _ => None,\n    }\n}","tryCatchPattern":null,"preventionTips":["Trim external input before it reaches InitSystem::from_str","Keep the accepted list (auto, systemd, openrc) next to any wrapper that sets --service-init","Fail fast in wrappers with a usage message instead of forwarding unknown values"],"tags":["cli","argument-parsing","init-system","validation"],"backgroundTag":"invalid-cli-argument","analyzedSha":"88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc","analyzedAt":"2026-08-23T01:07:41.857Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}