-
Notifications
You must be signed in to change notification settings - Fork 5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to fix the err:Returned values aren't valid, did it run Out of Gas?Returned values aren't valid, did it run Out of Gas? #3466
Comments
@Li6lac Could you provide a simple example of the code (both JS and Solidity) that triggers this error so someone can reproduce the problem and debug? It would also be helpful to know the version info of the Geth client you're using.
This is a really common cause of that error fwiw - perhaps you are making calls to the wrong address or not creating the contract with the correct ABI. |
Thanks for reply.
set() works well,but get() meets the error.
my geth is the newest .the way for deploying and calling in geth is diffrent from above but meets the same error.What's more,there's no error in ganache-cli.And if using solidity 0.4.* ,there's no error.I think perhaps dealing the problem in ropsten will deal the other. |
@Li6lac Tried to reproduce this using the Ropsten address you linked to but everything worked and did not get an error. Compiled the contract using [
{
"inputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"constant": true,
"inputs": [],
"name": "get",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"internalType": "string",
"name": "_value",
"type": "string"
}
],
"name": "set",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}
] Then ran: const Web3 = require('web3');
web3 = new Web3('https://ropsten.infura.io/v3/1d13168ffb894ad28....etc');
const contractAddress = '0x30951343d6d80d2c94897f1a81c53cc030aef879';
const contract = new web3.eth.Contract(abi, contractAddress)
const val = await contract.methods.get().call();
console.log(val); Output
|
ok,thank you,i get it |
I had a similar issue and was because I set wrong the ENDPOINT for web3 in my ENV, I was working on Rinkeby Network but I copied the wrong Endpoint
in case helps someone else |
Can be many things, but there are two causes most common.
|
me too is facing problem can u help me on this |
I get this error when I call just a 'get' function from a deployed contracted.This happens in real geth private blockchain and ropsten.I'm confused for a few weeks.Thanks for giving some suggestion.
My web3 is 1.2.6 and solcjs is 0.5.0+
the whole error message is 👍
{
err: Error: Returned values aren't valid, did it run Out of Gas? You might also see this error if you are not using the correct ABI for the contract you are retrieving data from, requesting data from a block number that does not exist, or querying a node which is not fully synced.
at ABICoder.decodeParameters (/home/lilac/WebstormProjects/web3_learn2/node_modules/web3-eth-abi/src/index.js:239:15)
at Contract._decodeMethodReturn (/home/lilac/WebstormProjects/web3_learn2/node_modules/web3-eth-contract/src/index.js:557:22)
at Method.outputFormatter (/home/lilac/WebstormProjects/web3_learn2/node_modules/web3-eth-contract/src/index.js:910:46)
at Method.formatOutput (/home/lilac/WebstormProjects/web3_learn2/node_modules/web3-core-method/src/index.js:167:54)
at sendTxCallback (/home/lilac/WebstormProjects/web3_learn2/node_modules/web3-core-method/src/index.js:596:33)
at /home/lilac/WebstormProjects/web3_learn2/node_modules/web3-core-requestmanager/src/index.js:147:9
at XMLHttpRequest.request.onreadystatechange (/home/lilac/WebstormProjects/web3_learn2/node_modules/web3-providers-http/src/index.js:110:13)
at XMLHttpRequestEventTarget.dispatchEvent (/home/lilac/WebstormProjects/web3_learn2/node_modules/xhr2-cookies/dist/xml-http-request-event-target.js:34:22)
at XMLHttpRequest._setReadyState (/home/lilac/WebstormProjects/web3_learn2/node_modules/xhr2-cookies/dist/xml-http-request.js:208:14)
at XMLHttpRequest._onHttpResponseEnd (/home/lilac/WebstormProjects/web3_learn2/node_modules/xhr2-cookies/dist/xml-http-request.js:318:14)
at IncomingMessage. (/home/lilac/WebstormProjects/web3_learn2/node_modules/xhr2-cookies/dist/xml-http-request.js:289:61)
at IncomingMessage.emit (events.js:323:22)
at endReadableNT (_stream_readable.js:1204:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21),
val: undefined
}
I'm a real new learner.Thanks for help.
The text was updated successfully, but these errors were encountered: