Authentication issues with SF CLI orgs.
Question
When attempting to execute a migration job and connect to my orgs, I encounter the following error:
Command initialization error: Access token to the CAREFUL_PRODUCTION_CAREFUL has expired or the user has no access.
How can I resolve this?
Answer
This error can occur for several reasons:
If you're using the
orgssection inexport.json(instanceUrl+accessToken), the token may have expired. Regenerate and update those values.If you're using CLI alias-based auth, ensure your local auth is current and refresh it:
sf org login web --alias <alias>sf org display --target-org <alias> --json
Verify that
apiVersionin yourexport.jsonis formatted as a string, not a number. For example, use"65.0"instead of65.0.If you do not need a fixed API version, remove
apiVersionfromexport.jsonand let SFDMU auto-detect the default API version for your org setup.