hadv / hadv/vito-interface

๐Ÿ› WalletConnect 'No matching key' runtime errors causing red error toasts

Open
#59 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
1
Forks
0
PR merge metrics
No merged PRs in 30d

Description

## ๐Ÿ› Bug Description

WalletConnect is throwing runtime errors with "No matching key. session or pairing topic doesn't exist" messages that appear as red error toasts in the development environment. These errors occur when disconnecting from mobile wallets and are causing poor developer experience.

## ๐Ÿ” Error Details

**Error Messages:**
```
No matching key. session or pairing topic doesn't exist: [topic-id]
No matching key. session: [topic-id]
```

**Stack Trace:**
```
at Cs.isValidSessionOrPairingTopic (bundle.js:48161:13)
at Cs.isValidDisconnect (bundle.js:47850:18)
at Cs.onSessionDeleteRequest (bundle.js:47367:14)
at Cs.processRequest (bundle.js:47010:29)
at Cs.processRequestsQueue (bundle.js:46975:22)
at Cs.onRelayEventRequest (bundle.js:46965:51)
at Cs.onRelayMessage (bundle.js:48063:139)
at async Cs.onProviderMessageEvent (bundle.js:46963:97)
```

## ๐Ÿ”„ Reproduction Steps

1. Connect wallet using WalletConnect
2. Disconnect from the mobile wallet app
3. Observe red error toast appearing in development environment

## ๐ŸŽฏ Root Cause Analysis

The errors originate from WalletConnect's internal validation methods:
- `isValidSessionOrPairingTopic()`
- `isValidDisconnect()`
- Session store `getData()` and `get()` methods

These methods are called during session cleanup but fail when trying to validate sessions that have already been deleted by the mobile wallet.

## ๐Ÿ› ๏ธ Attempted Solutions

Multiple approaches were attempted:

1. **Console Error Override** - Only suppresses console output, not runtime errors
2. **Global Error Handlers** - Errors bypass window.addEventListener('error')
3. **Error Constructor Override** - Creates infinite loops and complexity
4. **Internal Method Patching** - Methods don't exist on accessible signClient instances
5. **React Error Boundary Patching** - Errors occur before reaching React boundaries

## ๐Ÿ’ก Recommended Solution

This appears to be a known issue with WalletConnect v2 session management. Potential solutions:

1. **Upgrade WalletConnect** to latest version with better error handling
2. **Implement proper session synchronization** between services
3. **Add error boundaries** specifically for WalletConnect components
4. **Use WalletConnect's built-in error suppression** if available

## ๐Ÿ“‹ Technical Details

**Environment:**
- React development environment
- WalletConnect v2
- Multiple WalletConnect service instances (WalletConnectService + DAppWalletConnectService)

**Impact:**
- โŒ Poor developer experience with red error toasts
- โŒ Console pollution with error messages
- โœ… Application functionality remains intact
- โœ… No impact on production builds

## ๐ŸŽฏ Acceptance Criteria

- [ ] No red error toasts when disconnecting from mobile wallet
- [ ] Clean console output during WalletConnect operations
- [ ] Preserved error handling for legitimate errors
- [ ] Maintained WalletConnect functionality

## ๐Ÿท๏ธ Labels

`bug` `walletconnect` `developer-experience` `error-handling` `low-priority`

---

**Note:** This is a development-only issue that doesn't affect production functionality. The errors are cosmetic but impact developer experience.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.