Skip to content

acp client subcommand error handler uses String(err) instead of formatErrorMessage #83904

@davinci282828

Description

@davinci282828

Severity: low / Confidence: high / Category: bug
Triage: confirmed-bug
Detected against: openclaw v2026.5.18 (latest stable at time of scan, 2026-05-18)
Tooling: clawpatch 0.3.0 + acpx/claude-sonnet-4-5 via Brad Mills protocol

Evidence

  • src/cli/acp-cli.ts:52-52 (registerAcpCli)
defaultRuntime.error(`ACP bridge failed: ${formatErrorMessage(err)}`);
  • src/cli/acp-cli.ts:76-76 (registerAcpCli)
defaultRuntime.error(String(err));

Reasoning

The parent acp command formats errors through formatErrorMessage, which normalises Error objects to readable messages. The acp client subcommand uses String(err), which for a plain Error produces '[object Error]' in environments where Error.prototype.toString returns the default. This degrades the UX for client failures versus server failures and creates inconsistency that makes log triage harder.

Reproduction

Throw a non-Error object (e.g. throw { code: 42 }) inside runAcpClientInteractive; the acp client action emits '[object Object]' while acp would emit a structured message.

Recommendation

Change line 76 in src/cli/acp-cli.ts from defaultRuntime.error(String(err)) to defaultRuntime.error(formatErrorMessage(err)). formatErrorMessage is already imported in the file.

Why existing tests miss this

No tests exist for the CLI registration functions in this file group.

Suggested regression test

Unit test: mock runAcpClientInteractive to reject with a plain object; assert the emitted error message equals the output of formatErrorMessage, not '[object Object]'.

Minimum fix scope

Single-line change in src/cli/acp-cli.ts line 76.


Standardized clawpatch finding. Persistent in v2026.5.18 (not resolved by upgrading from v2026.5.12). Finding ID: fnd_sig-feat-cli-command-17e3589ff2-_d9920221f1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low-priority cleanup, docs, polish, ergonomics, or speculative work.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions