diff --git a/src/cli/error-format.ts b/src/cli/error-format.ts index ae4b7b51bd5..3a01fdc04ab 100644 --- a/src/cli/error-format.ts +++ b/src/cli/error-format.ts @@ -71,6 +71,7 @@ export function formatGatewayCommandFailure(params: { const raw = params.error instanceof Error ? params.error.message : String(params.error); const message = raw .replace(/\s*Run [`"]?openclaw doctor[`"]? for diagnostics\.?/gi, "") + .replace(/\s+Gateway target:\s+.*$/isu, "") .replace(/\s+/g, " ") .trim() .replace(/[.。]+$/u, ""); diff --git a/src/cli/secrets-cli.test.ts b/src/cli/secrets-cli.test.ts index 456b6a51362..f2100b3aff4 100644 --- a/src/cli/secrets-cli.test.ts +++ b/src/cli/secrets-cli.test.ts @@ -177,7 +177,9 @@ describe("secrets CLI", () => { it("explains Gateway reload failures without duplicate doctor noise", async () => { callGatewayFromCli.mockRejectedValue( - new Error("gateway closed (1006 abnormal closure). Run `openclaw doctor` for diagnostics."), + new Error( + "gateway closed (1006 abnormal closure). Gateway target: ws://127.0.0.1:18789 Source: local loopback Config: /tmp/openclaw.json Bind: loopback Possible causes: - Gateway not yet ready. Run `openclaw doctor` for diagnostics.", + ), ); await expect( @@ -188,6 +190,7 @@ describe("secrets CLI", () => { "Could not reload secrets because the Gateway did not respond: gateway closed (1006 abnormal closure).", ); expect(runtimeErrors.at(-1)).toContain("openclaw gateway status --deep"); + expect(runtimeErrors.at(-1)).not.toContain("Gateway target:"); expect(runtimeErrors.at(-1)).not.toContain("diagnostics.."); });