Skip to content

Permission error shows [object Object] instead of actual error details #1188

@lewis617

Description

@lewis617

Bug

In packages/code/src/acp/agent.ts:646, when requestPermission fails, the error message shows [object Object] instead of the actual error details.

Current code:

message: `Error requesting permission: ${error instanceof Error ? error.message : String(error)}`,

The ACP SDK throws JSON-RPC error objects (e.g. { code: -32601, message: "Method not handled" }) which are not Error instances. String({code: -32601, message: "..."}) produces [object Object].

Fix

Use JSON.stringify for non-Error objects:

message: `Error requesting permission: ${error instanceof Error ? error.message : JSON.stringify(error)}`,

Reproduction

When the ACP client does not handle session/request_permission, the agent receives an error response but displays:

Error: Edit operation denied by user, reason: Error requesting permission: [object Object]

Instead of:

Error: Edit operation denied by user, reason: Error requesting permission: {"code":-32601,"message":"Method not handled: session/request_permission"}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    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