aaif-goose/goose · error

Cannot update message because the active prompt could not be

Error message

Cannot update message because the active prompt could not be cancelled

What it means

Thrown in the same edit path after startPromptCancellation succeeded: the actual ACP call acpCancelPrompt(sessionId) rejected, so the active prompt could not be cancelled on the agent. The catch block first restores the prompt-cancellation state (restorePromptCancellation) to keep the store consistent, then throws this error. Root causes live in the ACP session: connection dropped, session id no longer valid on the backend, or the agent rejecting cancellation.

Source

Thrown at ui/desktop/src/acp/chatSessionController.ts:301

      pendingToolPermissionPromptAttemptId
    );
    if (!cancellation) {
      throw new Error('Cannot update message while prompt is active');
    }

    const promptCancellationSettled = acpChatSessionActions.waitForPromptCancellation(
      sessionId,
      pendingToolPermissionPromptAttemptId
    );

    try {
      await acpCancelPrompt(sessionId);
    } catch {
      acpChatSessionActions.restorePromptCancellation(
        sessionId,
        pendingToolPermissionPromptAttemptId
      );
      throw new Error('Cannot update message because the active prompt could not be cancelled');
    }

    cancelAcpPermissionRequestsForSession(sessionId);
    cancelAcpElicitationRequestsForSession(sessionId);
    await promptCancellationSettled;
  }

  acpChatSessionActions.setChatState(sessionId, ChatState.Thinking);

  try {
    await acpTruncateSessionConversation(sessionId, message.created);

    const truncatedMessages = currentMessages.filter((m) => m.created < message.created);
    const updatedUserMessage = createUserMessage(newContent, retainedImages);

    const messagesForUI = [...truncatedMessages, updatedUserMessage];
    acpChatSessionActions.setMessages(sessionId, messagesForUI);

View on GitHub (pinned to 3810898a74)

Solutions

  1. Check the ACP connection state (getAcpClient connectivity) — if the socket is dead, reconnect and retry the edit.
  2. Verify the session still exists on the backend (session list) before retrying; recreate/recover the session if it was lost.
  3. Look at the underlying error from acpCancelPrompt in devtools — this thrown Error deliberately hides it; log the original cause.
  4. Retry the edit after reconnection: state was restored, so the edit can be re-submitted safely.

Example fix

// before
try {
  await acpCancelPrompt(sessionId);
} catch {
  acpChatSessionActions.restorePromptCancellation(sessionId, pendingToolPermissionPromptAttemptId);
  throw new Error('Cannot update message because the active prompt could not be cancelled');
}

// after (keep the cause chained)
try {
  await acpCancelPrompt(sessionId);
} catch (cause) {
  acpChatSessionActions.restorePromptCancellation(sessionId, pendingToolPermissionPromptAttemptId);
  throw new Error('Cannot update message because the active prompt could not be cancelled', { cause });
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Confirm the ACP connection is alive before attempting prompt cancellation
const healthy = await isAcpConnectionHealthy(sessionId); // e.g. ping/status via client
if (!healthy) {
  await reconnectAcp();
}

Try / catch

try {
  await submitEditedMessage(sessionId, messageId, newContent, retainedImages, options);
} catch (error) {
  if (/could not be cancelled/.test(String(error))) {
    // State was restored by the controller; safe to reconnect and retry the edit once
    await reconnectAcp();
    return submitEditedMessage(sessionId, messageId, newContent, retainedImages, options);
  }
  throw error;
}

Prevention

When it happens

Trigger: Editing a message while the permission prompt is active, but the websocket to goose has disconnected or the session was closed/restarted server-side; acpCancelPrompt timing out; session id from a previous backend run.

Common situations: Backend restart under the desktop app; network blip dropping the ACP socket; user edits during a long-running tool permission while the agent process is being updated.

Related errors


AI-assisted analysis of aaif-goose/goose@3810898a74 (2026-08-16). Data as JSON: /api/errors/8e803ab33eb805b4. Report an issue: GitHub.