






























@@ -3,6 +3,7 @@ import { cancel, confirm, isCancel, multiselect } from "@clack/prompts";
33import { formatCliCommand } from "../cli/command-format.js";
44import { isNixMode } from "../config/config.js";
55import { resolveGatewayService } from "../daemon/service.js";
6+import { formatErrorMessage } from "../infra/errors.js";
67import type { RuntimeEnv } from "../runtime.js";
78import { stylePromptHint, stylePromptMessage, stylePromptTitle } from "../terminal/prompt-style.js";
89import { resolveHomeDir } from "../utils.js";
@@ -54,15 +55,19 @@ function buildScopeSelection(opts: UninstallOptions): {
54555556async function stopAndUninstallService(runtime: RuntimeEnv): Promise<boolean> {
5657if (isNixMode) {
57-runtime.error("Nix mode detected; service uninstall is disabled.");
58+runtime.error(
59+`Nix mode detected; service uninstall is disabled. Manage the service through your Nix profile instead, then run ${formatCliCommand("openclaw status")} to verify.`,
60+);
5861return false;
5962}
6063const service = resolveGatewayService();
6164let loaded = false;
6265try {
6366loaded = await service.isLoaded({ env: process.env });
6467} catch (err) {
65-runtime.error(`Gateway service check failed: ${String(err)}`);
68+runtime.error(
69+`Gateway service check failed: ${formatErrorMessage(err)}. Run ${formatCliCommand("openclaw gateway status --deep")} for service diagnostics.`,
70+);
6671return false;
6772}
6873if (!loaded) {
@@ -72,13 +77,17 @@ async function stopAndUninstallService(runtime: RuntimeEnv): Promise<boolean> {
7277try {
7378await service.stop({ env: process.env, stdout: process.stdout });
7479} catch (err) {
75-runtime.error(`Gateway stop failed: ${String(err)}`);
80+runtime.error(
81+`Gateway stop failed: ${formatErrorMessage(err)}. Run ${formatCliCommand("openclaw gateway status --deep")} before retrying uninstall.`,
82+);
7683}
7784try {
7885await service.uninstall({ env: process.env, stdout: process.stdout });
7986return true;
8087} catch (err) {
81-runtime.error(`Gateway uninstall failed: ${String(err)}`);
88+runtime.error(
89+`Gateway uninstall failed: ${formatErrorMessage(err)}. Run ${formatCliCommand("openclaw gateway status --deep")} for the service state.`,
90+);
8291return false;
8392}
8493}
@@ -101,14 +110,18 @@ export async function uninstallCommand(runtime: RuntimeEnv, opts: UninstallOptio
101110const { scopes, hadExplicit } = buildScopeSelection(opts);
102111const interactive = !opts.nonInteractive;
103112if (!interactive && !opts.yes) {
104-runtime.error("Non-interactive mode requires --yes.");
113+runtime.error(
114+`Non-interactive uninstall requires --yes. Preview first with ${formatCliCommand("openclaw uninstall --dry-run --all")}.`,
115+);
105116runtime.exit(1);
106117return;
107118}
108119109120if (!hadExplicit) {
110121if (!interactive) {
111-runtime.error("Non-interactive mode requires explicit scopes (use --all).");
122+runtime.error(
123+`Non-interactive uninstall requires explicit scopes. Use --all, or choose scopes such as --service --state.`,
124+);
112125runtime.exit(1);
113126return;
114127}
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。