libnyanpasu/clash-nyanpasu · error

failed to stop service, exit code

Error message

failed to stop service, exit code: {}, signal: {:?}

What it means

stop_service ran the service stopper with elevated privileges (RunasCommand on Windows, sudo on macOS) and the child process exited non-zero, so the nyanpasu service was not stopped. The check fires when the privileged stop command returns failure — typically a denied elevation prompt or the service manager refusing/still holding the service.

Solutions

  1. Retry and accept the elevation prompt.
  2. Check the service's current state with status(); it may already be stopped or stuck.
  3. Stop the underlying core process manually if the service is hung, then retry stop_service.
  4. Run the service binary manually with the `stop` argument as administrator to see detailed error output; reinstall the service if it remains unresponsive.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at backend/tauri/src/core/service/control.rs:242 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/e583ecd41a21bf4a. Report an issue: GitHub.

Appendix: source

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

    })
    .await??;
    if !child.success() {
        anyhow::bail!(
            "failed to stop service, exit code: {}, signal: {:?}",
            child.code().unwrap_or(-1),
            {
                #[cfg(unix)]
                {
                    child.signal().unwrap_or(0)
                }
                #[cfg(not(unix))]
                {
                    0
                }
            }
        );
    }
    Ok(())
}

View on GitHub (pinned to f7dbce2997)