vercel/ai · error · Error

ACP prompt update stream failed: ${causeMessage}

Error message

ACP prompt update stream failed: ${causeMessage}

What it means

The ACP (Agent Client Protocol) bridge wraps every failure that occurs while the agent's prompt-update events are being streamed back into the Harness runTurn loop. Instead of letting the raw underlying error escape, the bridge rethrows it as a bridge error with stage 'prompt update stream' and the original error attached as `cause`. The `causeMessage` in the message comes from that underlying failure (connection drop, protocol violation, agent crash, etc.), so read the cause to find the real problem.

Source

Thrown at packages/harness-acp/src/v1/bridge/index.ts:332

      turn.abortSignal.addEventListener('abort', () => void cancel(), {
        once: true,
      });
    }
    for (;;) {
      let message: acp.ActiveSessionMessage;
      try {
        message = await Promise.race([
          activeSession.nextUpdate(),
          cancellationFailure,
          activeAgentResponseStreamFailure,
        ]);
      } catch (error) {
        for (const rawValue of streamCapture?.drainRawValues() ?? []) {
          emitStreamEvent.raw({ rawValue });
        }
        emitStreamEvent.close();
        if (error === cancellationFailureError) throw error;
        throw createACPBridgeError({
          stage: 'prompt update stream',
          cause: error,
        });
      }
      if (message.kind === 'session_update') {
        const captured = streamCapture?.takeForUpdate({
          update: message.update,
        });
        for (const rawValue of captured?.precedingRawValues ?? []) {
          emitStreamEvent.raw({ rawValue });
        }
        emitStreamEvent.message({
          message,
          rawUpdate: captured?.rawUpdate,
        });
        continue;
      }
      for (const rawValue of streamCapture?.drainRawValues() ?? []) {

View on GitHub (pinned to 69428b1f8b)

Solutions

  1. Read `error.cause` (or the causeMessage in the message) to identify the actual underlying failure.
  2. Check that the ACP agent process is still alive and the transport (stdio/socket) did not terminate mid-turn.
  3. Enable ACP diagnostics/logging to capture the last session_update received before the failure.
  4. Retry the turn if the failure was a transient transport drop; otherwise fix the agent or protocol payload that caused the crash.

Example fix

// before: only logging the wrapper message
catch (e) { console.log(e.message); }
// after: surface the underlying cause
catch (e) {
  console.error(e.message, e.cause);
  if (ACPBridgeError.isInstance(e) && e.stage === 'prompt update stream') {
    retryTurnOrReportAgentCrash(e.cause);
  }
}
Defensive patterns

Strategy: try-catch

Type guard

function isACPBridgeError(e: unknown): e is { stage: string; cause: unknown } {
  return typeof e === 'object' && e !== null && 'stage' in e && 'cause' in e;
}

Try / catch

try {
  await runTurn(...);
} catch (error) {
  if (isACPBridgeError(error) && error.stage === 'prompt update stream') {
    logger.error('ACP prompt stream failed', { cause: error.cause });
  }
  throw error;
}

Prevention

When it happens

Trigger: Any error thrown inside the prompt/update event stream processing in runTurn: the connected ACP agent closes the connection or crashes mid-turn, sends a malformed session_update, a streamCapture consumer throws, or the underlying transport rejects while emitting raw stream values.

Common situations: Agent process killed mid-turn (OOM, timeout, Ctrl-C); network disconnect between client and ACP agent; agent emitting an update that violates the ACP protocol; serialization failure in a custom stream handler.

Related errors


AI-assisted analysis of vercel/ai@69428b1f8b (2026-08-30). Data as JSON: /api/errors/9a6c188e029f42e2. Report an issue: GitHub.