libnyanpasu/clash-nyanpasu · error

failed to query service status, exit code

Error message

failed to query service status, exit code: {}, signal: {:?}

What it means

status spawns the service binary directly (no elevation; CREATE_NO_WINDOW on Windows) with `status --json` and this guard fires when that query process exits non-zero. It means the service could not be queried — commonly because the service is not installed, its binary is missing, or the service manager refused the request — so no StatusInfo can be returned.

Solutions

  1. If the service is not installed, treat this as 'service absent' and install it via install_service rather than retrying the query.
  2. Verify SERVICE_PATH exists and is executable; a stale path after an update causes the query to fail.
  3. Run the service binary with `status --json` manually to see its error output.
  4. Check OS service registration (sc query / launchctl list) to confirm the service exists.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at backend/tauri/src/core/service/control.rs:311 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of libnyanpasu/clash-nyanpasu@f7dbce2997 (2026-09-08). Data as JSON: /api/errors/5f243fd58966e199. Report an issue: GitHub.

Appendix: source

Thrown at backend/tauri/src/core/service/control.rs:311

pub async fn status<'a>() -> anyhow::Result<nyanpasu_ipc::types::StatusInfo<'a>> {
    let mut cmd = tokio::process::Command::new(SERVICE_PATH.as_path());
    cmd.args(["status", "--json"]);
    #[cfg(windows)]
    cmd.creation_flags(0x08000000); // CREATE_NO_WINDOW
    let output = cmd.output().await?;
    if !output.status.success() {
        anyhow::bail!(
            "failed to query service status, exit code: {}, signal: {:?}",
            output.status.code().unwrap_or(-1),
            {
                #[cfg(unix)]
                {
                    output.status.signal().unwrap_or(0)
                }
                #[cfg(not(unix))]
                {
                    0
                }
            }
        );
    }

View on GitHub (pinned to f7dbce2997)