[SalesForce] Failed to login: UNSUPPORTED_API_VERSION – Invalid Api version specified on URL

I'm using the Force Migration Tool (Ant Task) and getting an error on a deploy command:

<target name="deployCode">
    <sf:deploy 
        username="${sf.usernameDestination}" 
        password="${sf.passwordDestination}" 
        serverurl="${sf.serverUrlDestination}" 
        deployRoot="code" 
        rollbackOnError="true"/>
</target>

I am getting the following error:

build.xml:23: Failed to login: UNSUPPORTED_API_VERSION – Invalid Api version specified on URL

As I am deploying to a sandbox, the value for ${sf.serverUrlDestination} is https://test.salesforce.com.

I've verified the username and password values and they are correct.

Best Answer

If you just downloaded the latest version, and your sandbox hasn't been upgraded yet, you'd receive this error. Try getting an older version, it wait until the final upgrade later this month.