I am using Truffle suite in a project in production, but I am sick of dealing with this error I feel shouldn't even be happening, and maybe its because of something that Avalanche has set on their side, but I am hoping for some clarity here.

I keep getting presented with this error when running migrations, it happens at entirely random intervals (mid script after 4 successful txs, while also happening immidiately when the script is run). This error happens every migration, run of a script, or anything targeting C-Chain (mainnet). Even a script calling 'read-only' functions...

Error: Unhandled error. ({ code: -32000, message: 'cannot query unfinalized data' }) at new NodeError (node:internal/errors:371:5) at Web3ProviderEngine.emit (node:events:379:17)

I have asked this question already in the Avalanche dev discord chat, and I was informed verbatim that:

That error message is returned when someone specifies a height that is > than the last accepted block height.

Not only this, but allegedly this same check is present on fuji testnet, and i NEVER EVER EVER have this issue on fuji testnet...

Since I am using truffle's contract abstractions, I am not aware how I could be 'specifying' anything, in fact I added the Avalanche recommended gas levels to the truffle-config, which did not help at all. There is no mention of this error in truffle docs anywhere or this concept from what i can find. Not as it relates to errors in migrations or with the truffle contracts package etc...

For those that will give me the answer of 'use hardhat bro', I HAVE used hardhat and i loathe it. Want to spend time writing contracts not fiddling with plug ins. Truffles abi's make keeping track of projects with many contracts and moving addresses a breeze, which is why I am trying to make the most of truffle suite, albeit the docs leaving something to be desired, especially with drizzle....

1 Answer 1


The problem might be related to determining the finality of blocks on Avalanche C-Chain. You can also try setting the allow-unfinalized-queries config on your node client to true (default is false). This setting allows queries for unfinalized (not yet accepted) blocks/transactions.




  • This looks like its for setting this boolean on the AvalancheGo client. This is not the issue, seems like a block polling issue if anything, increasing polling interval in chain config does not fix. To clarify I am using a script file within the context of truffle. So any and all 'chain configs' go into the truffle-config.js. I still appreciate the help. But if its a thing that I need to change it must be in truffle, as thats what gives me my contract abstractions and provider/wallets etc. Commented Oct 26, 2022 at 18:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.