Warning: Source file does not specify required compiler version! Consider adding "pragma solidity ^0.x.xx"

I’ve been getting this error lately when trying to deploy contracts even if I have already deployed them before in the past. Sometimes I just switch from Chrome to Firefox and it works but some will not work on either browser.

I have the pragma solidity tag at the top and in most if not all cases the contract was already deployed just days ago. The issue I’m experiencing is using Remix, and it happens with multiple different contracts using different compiler versions. See the example in this screenshot I deployed just yesterday and now it won’t compile even tho nothing was changed.

Is it something with Remix? Or is it something I am doing wrong.

Can you share the contract source code?

This does look weird so I don’t know what could be going on.

Yes it’s very weird. It happens with multiple contracts not just one in particular. The worst part is that it’ll happen with a contract that was deployed just a few hours or days ago.

One more thing I noticed is that if I change tabs to another contract or if I click the tab of the current contract, the code will disappear. It seems as if I never pasted the code on there at all.

Starting to think it’s an issue with remix. But it’s happening to me on both Chrome and Firefox.

This looks a bit as if it was compiling a different file than the one it’s showing…

Is the error reproducible when you use the compiler directly on the command line? (you can get the binary for your version/platform from https://github.com/ethereum/solc-bin/).

1 Like