{"record":{"id":"b771d865f48fa021","repo":"jdx/mise","slug":"systemctl-user-failed","errorCode":null,"errorMessage":"`systemctl --user {}` failed: {}","messagePattern":"`systemctl --user (.+?)` failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/systemd.rs","lineNumber":866,"sourceCode":"        );\n    }\n    Ok(false)\n}\n\nasync fn systemctl(args: &[String]) -> Result<()> {\n    debug!(\"$ systemctl --user {}\", shell_words::join(args));\n    let mut cmd = tokio::process::Command::new(\"systemctl\");\n    cmd.arg(\"--user\")\n        .args(args)\n        .stdin(Stdio::null())\n        .stdout(Stdio::piped())\n        .stderr(Stdio::piped())\n        .kill_on_drop(true);\n    let output = tokio::time::timeout(SYSTEMCTL_TIMEOUT, cmd.output())\n        .await\n        .map_err(|_| eyre!(\"`systemctl --user {}` timed out\", shell_words::join(args)))??;\n    if !output.status.success() {\n        bail!(\n            \"`systemctl --user {}` failed: {}\",\n            shell_words::join(args),\n            String::from_utf8_lossy(&output.stderr).trim()\n        );\n    }\n    Ok(())\n}\n\nasync fn disable_unit(unit: &str) -> Result<()> {\n    match systemctl(&[\"disable\".to_string(), unit.to_string()]).await {\n        Ok(()) => Ok(()),\n        Err(err) if disable_unit_error_is_noop(&err.to_string()) => {\n            debug!(\"systemd: ignoring disable for {unit}: {err}\");\n            Ok(())\n        }\n        Err(err) => Err(err),\n    }\n}","sourceCodeStart":848,"sourceCodeEnd":884,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/systemd.rs#L848-L884","documentation":"systemctl helper ran `systemctl --user <args>` and the command completed with a non-zero exit status; the message embeds the arguments and stderr. The failure comes from systemd itself (unit missing, not loaded, operation refused), not from spawning the binary.","triggerScenarios":"Thrown at src/system/systemd.rs:866 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Read the embedded stderr — it states systemd's reason","Run `systemctl --user status <unit>` to inspect the unit state","Check that the unit file exists and `systemctl --user daemon-reload` has run"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}