Skip to content

fix(idb): Handle IndexedDB errors in query cache persister gracefully#119489

Closed
billyvg wants to merge 1 commit into
masterfrom
claude/serene-cannon-xnnnkg
Closed

fix(idb): Handle IndexedDB errors in query cache persister gracefully#119489
billyvg wants to merge 1 commit into
masterfrom
claude/serene-cannon-xnnnkg

Conversation

@billyvg

@billyvg billyvg commented Jul 13, 2026

Copy link
Copy Markdown
Member

Summary

A Sentry alert fired for ConstraintError: A mutation operation in the transaction failed because a constraint was not satisfied. from the JavaScript platform in the control environment. The error originated in the browser's IndexedDB subsystem on the /settings/:orgId/projects/ page, captured with handled: true and no stack trace.

The only IndexedDB-backed code in the Sentry frontend is appQueryClient.tsx, which uses idb-keyval to persist the React Query bootstrap-projects cache. IndexedDB can throw DOMExceptions (ConstraintError, QuotaExceededError, etc.) in certain browser conditions (Firefox, private browsing, corrupted storage). Previously these exceptions would bubble up unhandled through PersistQueryClientProvider and get captured by Sentry with no actionable information.

Changes:

  • Wrap idb-keyval operations (get, set, del) in resilient adapters that catch storage exceptions
  • On any write failure, clear the potentially-corrupted cache entry and disable IDB persistence for the rest of the session
  • Read/remove failures also disable IDB so the app keeps working without storage

This prevents the error from reaching Sentry (it was noise: handled, no stack trace, single browser occurrence) and ensures the app degrades gracefully when IDB is unavailable.

Evidence / Reasoning:

  • Sentry issue #7607519198: single occurrence, handled: true, no frames in stacktrace
  • Triggered by one Firefox 152.0 / macOS user visiting settings/projects — browser-level IDB failure, not a product bug
  • No test changes needed: the error is caught silently and the cache falls back to non-persistent mode, which is already tested behavior
  • Session: https://claude.ai/code/session_015NbPDLwEwyAJfbeFe9cpua

Generated by Claude Code

IndexedDB can throw DOMExceptions (ConstraintError, QuotaExceededError, etc.)
in certain browsers or when storage is corrupted. Previously these would bubble
up unhandled and be reported to Sentry with no stack trace, providing no
actionable information.

This wraps the idb-keyval operations with resilient adapters: on any failure,
corrupted data is cleared and IDB persistence is disabled for the remainder of
the session so the app continues functioning normally.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015NbPDLwEwyAJfbeFe9cpua
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jul 13, 2026
@billyvg billyvg closed this Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants