jdx/mise · error

`systemctl --user ` failed

Error message

`systemctl --user {}` failed: {}

What it means

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.

Solutions

  1. Read the embedded stderr — it states systemd's reason
  2. Run `systemctl --user status <unit>` to inspect the unit state
  3. Check that the unit file exists and `systemctl --user daemon-reload` has run
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at src/system/systemd.rs:866 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/b771d865f48fa021. Report an issue: GitHub.

Appendix: source

Thrown at src/system/systemd.rs:866

        );
    }
    Ok(false)
}

async fn systemctl(args: &[String]) -> Result<()> {
    debug!("$ systemctl --user {}", shell_words::join(args));
    let mut cmd = tokio::process::Command::new("systemctl");
    cmd.arg("--user")
        .args(args)
        .stdin(Stdio::null())
        .stdout(Stdio::piped())
        .stderr(Stdio::piped())
        .kill_on_drop(true);
    let output = tokio::time::timeout(SYSTEMCTL_TIMEOUT, cmd.output())
        .await
        .map_err(|_| eyre!("`systemctl --user {}` timed out", shell_words::join(args)))??;
    if !output.status.success() {
        bail!(
            "`systemctl --user {}` failed: {}",
            shell_words::join(args),
            String::from_utf8_lossy(&output.stderr).trim()
        );
    }
    Ok(())
}

async fn disable_unit(unit: &str) -> Result<()> {
    match systemctl(&["disable".to_string(), unit.to_string()]).await {
        Ok(()) => Ok(()),
        Err(err) if disable_unit_error_is_noop(&err.to_string()) => {
            debug!("systemd: ignoring disable for {unit}: {err}");
            Ok(())
        }
        Err(err) => Err(err),
    }
}

View on GitHub (pinned to 533346cc37)