MetaMask / MetaMask/metamask-extension

[Bug]: Adding a custom RPC URL fails silently when another network already uses the same URL

Open Beginner friendly
#44,892 3 comments 0 reactions 0 assignees View on GitHub
cs-triaged external-contributor regression-prod-13.40.0 Sev3-low team-wallet-platform type-bug
Dominant language
TypeScript
Stars
13.2k
Forks
5.6k
Avg merge
2d 5h
Merged PRs (30d)
451

Description

### Describe the bug

When adding a custom RPC URL to a network, if another network already has the same URL configured, the UI shows "was successfully edited!" but nothing actually changes. No error is shown.

### Expected behavior

The UI should either show an error explaining why the update failed, or prevent the user from saving with an inline validation message.

### Screenshots/Recordings

_No response_

### Steps to reproduce

1. Go to Settings > Networks > Ethereum > Edit
2. Add a custom RPC URL (e.g. http://127.0.0.1:8545) — this works fine
3. Go to Settings > Networks > Arbitrum > Edit
4. Add the same RPC URL (http://127.0.0.1:8545)
5. Click Save
6. Success toast appears but the RPC was not added

If you remove the custom RPC from Ethereum first, then adding it to Arbitrum works. Only one network at a time can have a given custom RPC URL.

### Error messages or log output

```shell
Could not update network to point to same RPC endpoint as existing network for chain 0x1 ('Ethereum')
```

### Where was this bug found?

Live version (from official store)

### Version

13.40.0

### Build type

None

### Browser

Chrome

### Operating system

MacOS

### Hardware wallet

_No response_

### Additional context

The root cause is in networks-form.tsx — updateNetwork result is not checked after dispatching, and setEditedNetwork() fires unconditionally, showing the success toast regardless of whether the update succeeded. I'll be opening a PR with a fix for this.

### Severity

_No response_

Contributor guide

Open the contributing guide

Research direction

Start in networks-form.tsx and inspect how the updateNetwork result is handled after dispatch, along with the unconditional setEditedNetwork() call. Reproduce the duplicate RPC URL case from the issue steps, then verify that a failed update shows an error or inline validation instead of a success toast and that successful updates still do.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.