You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems that errors thrown by ethers quite often mask the true source of the code which triggered the error, instead resulting in a trace such as this one:
An unexpected error occurred:
Error: invalid BigNumber value (argument="value", value=undefined, code=INVALID_ARGUMENT, version=bignumber/5.7.0)
at Logger.makeError (/home/adam/myproject/node_modules/@ethersproject/abi/node_modules/@ethersproject/logger/src.ts/index.ts:269:28)
at Logger.throwError (/home/adam/myproject/node_modules/@ethersproject/abi/node_modules/@ethersproject/logger/src.ts/index.ts:281:20)
at Logger.throwArgumentError (/home/adam/myproject/node_modules/@ethersproject/abi/node_modules/@ethersproject/logger/src.ts/index.ts:285:21)
at Function.BigNumber.from (/home/adam/myproject/node_modules/@ethersproject/abi/node_modules/@ethersproject/bignumber/src.ts/bignumber.ts:289:23)
at NumberCoder.encode (/home/adam/myproject/node_modules/@ethersproject/abi/src.ts/coders/number.ts:25:27)
at /home/adam/myproject/node_modules/@ethersproject/abi/src.ts/coders/array.ts:71:19
at Array.forEach (<anonymous>)
at pack (/home/adam/myproject/node_modules/@ethersproject/abi/src.ts/coders/array.ts:54:12)
at TupleCoder.encode (/home/adam/myproject/node_modules/@ethersproject/abi/src.ts/coders/tuple.ts:54:20)
at /home/adam/myproject/node_modules/@ethersproject/abi/src.ts/coders/array.ts:62:19
at Array.forEach (<anonymous>)
at pack (/home/adam/myproject/node_modules/@ethersproject/abi/src.ts/coders/array.ts:54:12)
at TupleCoder.encode (/home/adam/myproject/node_modules/@ethersproject/abi/src.ts/coders/tuple.ts:54:20)
at AbiCoder.encode (/home/adam/myproject/node_modules/@ethersproject/abi/src.ts/abi-coder.ts:111:15)
at Interface._encodeParams (/home/adam/myproject/node_modules/@ethersproject/abi/src.ts/interface.ts:323:31)
at Interface.encodeFunctionData (/home/adam/myproject/node_modules/@ethersproject/abi/src.ts/interface.ts:378:18)
at /home/adam/myproject/node_modules/ethers/node_modules/@ethersproject/contracts/src.ts/index.ts:228:37
at step (/home/adam/myproject/node_modules/ethers/node_modules/@ethersproject/contracts/lib/index.js:48:23)
at Object.next (/home/adam/myproject/node_modules/ethers/node_modules/@ethersproject/contracts/lib/index.js:29:53)
at fulfilled (/home/adam/myproject/node_modules/ethers/node_modules/@ethersproject/contracts/lib/index.js:20:58)
at processTicksAndRejections (node:internal/process/task_queues:95:5) {
reason: 'invalid BigNumber value',
code: 'INVALID_ARGUMENT',
argument: 'value',
value: undefined
}
(Note this was previously reported in #3772 for other reasons.)
I originally thought this was hardhat's fault for the way it handles exceptions thrown during task execution, and reported it at NomicFoundation/hardhat#3671. However as pointed out by a hardhat maintainer, the other stack trace I pasted in that discussion shows that hardhat is perfectly capable of generating useful stack traces identifying the caller when tasks throw exceptions outside ethers. So it seems this problem is specific to ethers.
This can really cripple the effectiveness of the stack trace for debugging when the caller is shown as processTicksAndRejections (node:internal/process/task_queues rather than the actual code which truly called ethers.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
It seems that errors thrown by ethers quite often mask the true source of the code which triggered the error, instead resulting in a trace such as this one:
(Note this was previously reported in #3772 for other reasons.)
I originally thought this was hardhat's fault for the way it handles exceptions thrown during task execution, and reported it at NomicFoundation/hardhat#3671. However as pointed out by a hardhat maintainer, the other stack trace I pasted in that discussion shows that hardhat is perfectly capable of generating useful stack traces identifying the caller when tasks throw exceptions outside ethers. So it seems this problem is specific to ethers.
This can really cripple the effectiveness of the stack trace for debugging when the caller is shown as
processTicksAndRejections (node:internal/process/task_queues
rather than the actual code which truly called ethers.Is there a solution?
Beta Was this translation helpful? Give feedback.
All reactions