Skip to content

ACP: slash-command errors fail the prompt request with an opaque internal error #65715

Description

@liyihang866

Description

When a slash command fails during an ACP turn, the whole session/prompt
request fails and the client only sees Internal error: Internal service failure.
The command's real message (usage help, goal-state guidance) never reaches the client.

Cause: CommandExecutionError (thrown by the server for command failures) is not
recognized in packages/cli/src/acp/client.ts classify(), so the fiber dies and
fromUnknown() in packages/cli/src/acp/error.ts renders the opaque string.

Also seen: over ACP a successful /goal <objective> produces no session/update
at all — re-setting a goal replaces it silently. The client has no way to know.

Plugins

None (default goal plugin).

OpenCode version

2.3.2

Steps to reproduce

  1. Run opencode acp and connect from any ACP client
  2. Send /goal (bare, no argument)
  3. Client shows Internal error: Internal service failure instead of
    Usage: /goal <objective> | pause | resume | clear

With an active goal, sending /goal again fails the same way instead of showing
Goal active: ... use /goal clear guidance.

Screenshot

None (text-only client rendering).

Operating System

macOS (arm64); also reproduced on AlmaLinux 9.8

Terminal

n/a (ACP session, not the TUI)

Activity

  1. added
    area/ide-acp
    type/bug
    version/v2
    on Nov 23, 2026
  2. opencodejr commented on Nov 23, 2026

    @opencodejr
    Contributor

    Thanks for the detailed report. I reproduced this on 2.3.2, and it still happens on the latest dev (8c0be71).

    The script below runs opencode acp as a minimal ACP client: initialize, then session/new, then a session/prompt with a bare /goal. No model is needed. The prompt request fails with:

    {"code":-32603,"message":"Internal error: Internal service failure","data":{"errorName":"CommandExecutionError"}}
    

    The client never gets the command's usage text. I did not test the 'goal already active' case or whether a successful /goal <objective> sends a session/update, because both need a model turn.

    Reproduction script (acp-goal.mjs)
    // Reproduces #65715: a failing slash command over ACP surfaces as an opaque internal error.
    // Usage: node acp-goal.mjs [opencode command...]   (default: opencode)
    import { spawn } from "node:child_process"
    import { mkdtempSync } from "node:fs"
    import { tmpdir } from "node:os"
    import { join } from "node:path"
    const cmd = process.argv.slice(2).length ? process.argv.slice(2) : ["opencode"]
    const cwd = mkdtempSync(join(tmpdir(), "acp-goal-"))
    const child = spawn(cmd[0], [...cmd.slice(1), "acp"], { cwd, stdio: ["pipe", "pipe", "inherit"] })
    let buf = "", id = 0
    const pending = new Map()
    child.stdout.on("data", (d) => {
      buf += d
      let i
      while ((i = buf.indexOf("\n")) >= 0) {
        const line = buf.slice(0, i); buf = buf.slice(i + 1)
        if (!line.trim()) continue
        const msg = JSON.parse(line)
        if (msg.id !== undefined && pending.has(msg.id)) { pending.get(msg.id)(msg); pending.delete(msg.id) }
        else if (msg.method === "session/update") console.log("<- session/update", JSON.stringify(msg.params.update).slice(0, 300))
        else if (msg.method) { console.log("<- request", msg.method); if (msg.id !== undefined) child.stdin.write(JSON.stringify({ jsonrpc: "2.0", id: msg.id, error: { code: -32601, message: "n/a" } }) + "\n") }
      }
    })
    const call = (method, params) => new Promise((res) => {
      const n = ++id; pending.set(n, res)
      child.stdin.write(JSON.stringify({ jsonrpc: "2.0", id: n, method, params }) + "\n")
    })
    const init = await call("initialize", { protocolVersion: 1, clientCapabilities: {} })
    console.log("initialize ->", init.error ? JSON.stringify(init.error) : "ok")
    const s = await call("session/new", { cwd, mcpServers: [] })
    console.log("session/new ->", s.error ? JSON.stringify(s.error) : s.result.sessionId)
    const r = await call("session/prompt", { sessionId: s.result.sessionId, prompt: [{ type: "text", text: "/goal" }] })
    console.log("session/prompt '/goal' ->", JSON.stringify(r.error ?? r.result))
    child.kill(); process.exit(0)

    Run it: bun acp-goal.mjs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/ide-acpplatform/linuxplatform/macosreproducedtype/bugversion/v2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions