MetaMask / MetaMask/metamask-extension
[Bug]: Password unlock metrics report failed_attempts: 0 after incorrect password
- Dominant language
- TypeScript
- Stars
- 13.2k
- Forks
- 5.6k
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 451
Description
### Describe the bug
Regression found on production **13.47.0**.
On the Unlock screen, `failed_attempts` used in `AppUnlockedFailed` and `AppUnlocked` is only set when the error object includes `data.numberOfAttempts`. A standard local-vault **Incorrect password** error does not include that field, and the counter is never incremented.
Result: failed password attempts are reported as `failed_attempts: 0`. A later successful unlock also reports `0`.
Unlock itself still works. Impact is analytics / lockout metrics only.
### Expected behavior
Each failed password attempt should increase `failed_attempts` on `AppUnlockedFailed`. A later successful `AppUnlocked` should report the actual number of prior failures in that session.
### Screenshots/Recordings
_No response_
### Steps to reproduce
1. Install / open MetaMask **13.47.0** (Chrome Web Store / production).
2. Lock the wallet (or close and reopen so Unlock is shown).
3. Enter an incorrect password and submit. Repeat 2–3 times.
4. Confirm the UI shows the incorrect-password error each time.
5. Enter the correct password and unlock.
6. Inspect Segment / MetaMetrics (or debug metrics) for `App Unlocked Failed` and `App Unlocked`.
7. Observe `failed_attempts` is `0` on the failed events and on the successful unlock.
### Error messages or log output
```shell
UI correctly shows incorrect password. Metrics property failed_attempts stays 0.
```
### Detection stage
Production
### Version
13.47.0
### Build type
None
### Browser
Chrome
### Operating system
MacOS
### Hardware wallet
_No response_
### Additional context
Code path: `handleLoginError` in `ui/pages/unlock-page/unlock-page.component.tsx`.
`this.failed_attempts` is assigned only when `data?.numberOfAttempts !== undefined`. Local vault `Incorrect password` does not populate that field.
### Severity
Sev3-low — no user-facing unlock failure; metrics accuracy only.
Contributor guide
Research direction
Start in ui/pages/unlock-page/unlock-page.component.tsx at handleLoginError and inspect how failed_attempts is updated for local-vault incorrect-password errors. Reproduce repeated failed unlocks followed by a successful unlock, then verify the failed events and AppUnlocked report the actual number of prior failures.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- analytics, authentication
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100