Uniswap / Uniswap/interface

Crash report: `Error: Invariant failed`

Open
#5,048 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
5.5k
Forks
5.4k
PR merge metrics
No merged PRs in 30d

Description

URL

https://app.uniswap.org/#/swap?inputCurrency=0x0913ddae242839f8995c0375493f9a1a3bddc977&outputCurrency=ETH

swap state

{
  "INPUT": {
    "currencyId": "0xdAC17F958D2ee523a2206206994597C13D831ec7"
  },
  "OUTPUT": {
    "currencyId": "0x0cbA60Ca5eF4D42f92A5070A8fEDD13BE93E2861"
  },
  "independentField": "OUTPUT",
  "typedValue": "9",
  "recipient": null
}

Error

Error: Invariant failed

Stacktrace

Error: Invariant failed
    at i (https://app.uniswap.org/static/js/7.5e4576db.chunk.js:2:240022)
    at new e (https://app.uniswap.org/static/js/7.5e4576db.chunk.js:2:4072589)
    at e.createUncheckedTrade (https://app.uniswap.org/static/js/7.5e4576db.chunk.js:2:4074453)
    at e.encodeSwaps (https://app.uniswap.org/static/js/7.5e4576db.chunk.js:2:4088392)
    at e.swapCallParameters (https://app.uniswap.org/static/js/7.5e4576db.chunk.js:2:4090031)
    at https://app.uniswap.org/static/js/main.8240840c.chunk.js:1:258914
    at Object.Qa [as useMemo] (https://app.uniswap.org/static/js/7.5e4576db.chunk.js:2:3697297)
    at t.useMemo (https://app.uniswap.org/static/js/7.5e4576db.chunk.js:2:3522353)
    at https://app.uniswap.org/static/js/main.8240840c.chunk.js:1:258808
    at Aa (https://app.uniswap.org/static/js/main.8240840c.chunk.js:1:259461)

Device data

{
  "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36",
  "browser": {
    "name": "Chrome",
    "version": "108.0.0.0",
    "major": "108"
  },
  "engine": {
    "name": "Blink",
    "version": "108.0.0.0"
  },
  "os": {
    "name": "Windows",
    "version": "10"
  },
  "device": {},
  "cpu": {
    "architecture": "amd64"
  }
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported swap URL and state, then trace the swapCallParameters, encodeSwaps, and createUncheckedTrade entry points named in the stack trace. Done means this input no longer crashes with an unhandled “Invariant failed” error, with coverage added if an existing test location is identified.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
blockchain, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.