Skip to content

Disconnecting an app that's already gone shows "no such connected app" in a red box #882

Closed

Description

@richshaw

What happens

On Settings → Connected apps, the disconnect server action in src/app/app/(chrome)/settings/connected-apps/page.tsx catches a ServiceException from revokeConnectedApp and puts err.serviceError.message straight into the ?error= redirect. The page then shows that text in a FormError box.

revokeConnectedApp (src/oauth/grants.ts) throws not_found with the message "no such connected app" when the grant is gone. Disconnecting an app from a tab opened before it was already disconnected (in another tab, say) shows the organizer a red box reading "no such connected app": lowercase, written for developers.

Everywhere else, organizer refusals map the error code to plain words before showing them. SAVE_ERROR_MESSAGE in src/components/ui/save-notice.tsx does this for the Settings tab and Delete, and so do status-refusal.ts and responses/remove-refusal.ts. SAVE_ERROR_MESSAGE's comment says why: the service's own message "is written for developers". Connected apps is the one place that skips this step.

Its fallback for any other error, "Could not disconnect. Try again.", also breaks the house style. Nearby refusals say "Couldn’t …" with a curly apostrophe, e.g. "Couldn’t publish. Try again." and "Couldn’t remove them. Try again.".

Fix, in outline

  • Add a small disconnectRefusal(code) beside the page, shaped like status-refusal.ts:
    • not_found → "That app is already disconnected."
    • anything else → "Couldn’t disconnect. Try again."
  • Use it for both the ServiceException path and the unexpected-error path. Keep logging unexpected errors as today.
  • Call revalidatePath(PATH) before the error redirect too, so a stale row disappears from the list when the app was already gone.

Watch for

  • unauthorized ("sign in required") is effectively unreachable, because the action calls requireOrganizerSession() first. The mapping's fallback covers it anyway.
  • Help. If src/help/articles/connect-an-ai-assistant.tsx describes disconnecting, check it still reads true. It doesn't quote this error today.
  • Existing tests. src/oauth/flow.db.test.ts checks only the service's error codes. Leave them as they are.

Done when

  • A unit test for disconnectRefusal pins the wording for not_found and for another code.
  • The page never puts serviceError.message into the URL.
  • pnpm lint && pnpm format:check && pnpm typecheck && pnpm knip && pnpm test pass.

Found by the pipeline's refactor scout in the organizer settings pages (src/app/app/(chrome)/settings/connected-apps), at 001a284. Checked by an independent verify agent: a scratch DB test ran the page's catch logic against the real revokeConnectedApp with an unknown grant id, and the redirect decoded to "no such connected app". https://claude.ai/code/session_016YZ9STKE7qmnEctzqxYG4q

Activity

  1. added
    bug
    pipeline:ux
    pipeline:working
    and removed on Nov 13, 2026
  2. self-assigned this
    on Nov 13, 2026
  3. removed
    pipeline:working
    on Nov 13, 2026
  4. added a commit that references this issue on Nov 17, 2026
    0205b62
  5. removed
    pipeline:ux
    on Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions