sf auth web login command for non-preview sandbox generates json file `~/.sfdx/[email protected]` with preview API version "63.0" which produces many different errors
Note Before you submit your issue, make sure that:
- You're using the latest version of Salesforce CLI.
- You've searched both open and closed issues for related posts.
- You've used the
doctorcommand to diagnose common issues.- You understand that GitHub Issues don't adhere to any agreement or SLA.
- If you require immediate assistance, use official channels such as Salesforce Customer Support.
Summary
sf auth web login command for non-preview sandbox generates json file ~/.sfdx/[email protected] with preview API version "63.0" which produces many different errors
https://salesforce.stackexchange.com/questions/429908/strange-error-executing-any-sf-command-for-a-recently-refreshed-non-preview-sand/429909#429909
Steps To Reproduce
IMPORTANT Provide a repository that's configured to reproduce the issue. If you are unable to provide a repo, please explain why not. The more info we have from the start, the faster we can resolve your issue. We may close your issue if you don't include proper instructions.
- Generate a project with
sf project generateor fork dreamhouse-lwc.- Provide detailed step-by-step instructions on how to reproduce the issue.
- Create a non-preview sandbox.
- Authorize it using
sf auth web logincommand - Notice
instanceApiVersionhas preview version63.0. - if you try to execute
sf org openyou will receive an error with no description - If you try to execute
sf org open --jsonthere will be 404 not found errors probably because version 63.0 is not available for non-preview sandbox and any requests there fail as not found. - Same for
sf bulk data upsert
[!TIP] use
sf doctor --create-issueto automatically fill the required information
Expected result
Expect SF CLI work without any errors
Actual result
Multiple errors with no description or not found error description for json variant.
Additional information
https://i.sstatic.net/UmtYcfvE.png
https://i.sstatic.net/b5NKfxUr.png
https://i.sstatic.net/9nWcLF8K.png
System Information
{
"architecture": "darwin-arm64",
"cliVersion": "@salesforce/cli/2.74.6",
"nodeVersion": "node-v22.12.0",
"osVersion": "Darwin 24.3.0",
"rootPath": "/Users/bdovh/.local/share/sf/client/2.74.6-02685ea",
"shell": "zsh",
"pluginVersions": [
"@futurefirst/sfdx-plugin-picklist 0.0.1 (user) published 1700 days ago (Wed Jun 10 2020)",
"@oclif/plugin-autocomplete 3.2.18 (core)",
"@oclif/plugin-commands 4.1.17 (core)",
"@oclif/plugin-help 6.2.22 (core)",
"@oclif/plugin-not-found 3.2.37 (core)",
"@oclif/plugin-plugins 5.4.26 (core)",
"@oclif/plugin-search 1.2.19 (core)",
"@oclif/plugin-update 4.6.26 (core)",
"@oclif/plugin-version 2.2.20 (core)",
"@oclif/plugin-warn-if-update-available 3.1.31 (core)",
"@oclif/plugin-which 3.2.26 (core)",
"@salesforce/cli 2.74.6 (core)",
"apex 3.6.8 (core)",
"api 1.3.3 (core)",
"auth 3.6.87 (core)",
"community 3.3.8 (user) published 24 days ago (Sat Jan 11 2025) (latest is 3.3.10)",
"data 4.0.1 (core)",
"deploy-retrieve 3.17.7 (core)",
"info 3.4.32 (core)",
"limits 3.3.44 (core)",
"marketplace 1.3.7 (core)",
"org 5.2.23 (core)",
"packaging 2.9.12 (core)",
"schema 3.3.46 (core)",
"settings 2.4.10 (core)",
"signups 2.6.10 (user) published 24 days ago (Sat Jan 11 2025) (latest is 2.6.12)",
"sobject 1.4.49 (core)",
"telemetry 3.6.29 (core)",
"templates 56.3.35 (core)",
"trust 3.7.55 (core)",
"user 3.6.6 (core)"
]
}
Thank you for filing this issue. We appreciate your feedback and will review the issue as soon as possible. Remember, however, that GitHub isn't a mechanism for receiving support under any agreement or SLA. If you require immediate assistance, contact Salesforce Customer Support.
if you manually fix the instanceApiVersion key to the 62.0 value in ~/.sfdx/[email protected] that helps to avoid errors
hmm, this is interesting. We haven't changed the auth commands/libraries for some time.
it seems like the workaround of changing it in the file has fixed it for now... but if you delete the auth file, then re-auth, does it still show 63?
hmm, this is interesting. We haven't changed the auth commands/libraries for some time.
it seems like the workaround of changing it in the file has fixed it for now... but if you delete the auth file, then re-auth, does it still show 63?
haven't tried, I can try this approach
this is interesting, when I try it.
Initially it doesn't have any information about the API Version
{
"accessToken": "at",
"instanceUrl": "https://domain--dev2.sandbox.my.salesforce.com",
"orgId": "00D ",
"username": "bd @org.dev2",
"loginUrl": "https://test.salesforce.com/",
"refreshToken": "ref",
"clientId": "PlatformCLI",
"isDevHub": false,
"isScratch": false,
"isSandbox": true
}
later, if I execute any command, it appends information about the API version
cannot reproduce it that way...
Can this be a case that I had the same user with preview sandbox and when I refreshed it, it somehow kept the API version from the previous instance of the sandbox?
@WillieRuemmele confirming this is the case when I have the preview sandbox and refresh sandbox with the same username.
"instanceApiVersion": "63.0"
this key is kept from the previous sandbox.
Is this possible to fix?
{
"accessToken": "at",
"instanceUrl": "https://domain--dev20.sandbox.my.salesforce.com",
"orgId": "00D",
"username": "bd @org.dev20",
"loginUrl": "https://test.salesforce.com/",
"refreshToken": "rt",
"clientId": "PlatformCLI",
"isDevHub": false,
"instanceApiVersion": "63.0",
"instanceApiVersionLastRetrieved": "2/4/2025, 3:36:03 PM",
"isScratch": false,
"isSandbox": true,
"tracksSource": true
}
Notice: instanceApiVersionLastRetrieved was yesterday while I have refreshed sandbox today
@bdovh - thanks for investigating!
just to clarify and confirm:
after first auth, no apiVersion field
run a command against the org, apiVersion populated correctly?
refresh preview sandbox, with the same username, and apiVersion is remaining as the preview version (63.0)
it seems like the refresh command has a bug by not removing the apiVersion field.
is that correct?
@WillieRuemmele you asked me to delete the file. If I delete the file, I am not able to reproduce the issue. I think the problem if I use the same username for the old preview sandbox and newly refreshed non-preview sandbox and NOT delete the file
This issue has been linked to a new work item: W-17757493
@bdovh I'm not able to repro this, if you still have the sandbox around could you try this?:
- re-auth so you don't have
instanceApiVersionandinstanceApiVersionLastRetrievedset in the auth file - run
sf org display -o <sbx-user> --dev-debug --debug-filter connection
to gather the max API version supported by the org we query the services/data endpoint and grab the major one, example from my sandbox:
...
[16:45:35.483] DEBUG (sf:oclif:connection): request
method: "GET"
url: "https://johndoe.sandbox.my.salesforce.com/services/data"
headers: {
"content-type": "application/json",
"user-agent": "sfdx toolbelt:"
}
[16:45:36.037] DEBUG (sf:oclif:connection): response for org versions: 31.0,32.0,33.0,34.0,35.0,36.0,37.0,38.0,39.0,40.0,41.0,42.0,43.0,44.0,45.0,46.0,47.0,48.0,49.0,50
.0,51.0,52.0,53.0,54.0,55.0,56.0,57.0,58.0,59.0,60.0,61.0,62.0
[16:45:36.047] DEBUG (sf:oclif:connection): Connection created with apiVersion 62.0
...
@bdovh I'm not able to repro this, if you still have the sandbox around could you try this?:
- re-auth so you don't have
instanceApiVersionandinstanceApiVersionLastRetrievedset in the auth file- run
sf org display -o <sbx-user> --dev-debug --debug-filter connectionto gather the max API version supported by the org we query the
services/dataendpoint and grab the major one, example from my sandbox:... [16:45:35.483] DEBUG (sf:oclif:connection): request method: "GET" url: "https://johndoe.sandbox.my.salesforce.com/services/data" headers: { "content-type": "application/json", "user-agent": "sfdx toolbelt:" } [16:45:36.037] DEBUG (sf:oclif:connection): response for org versions: 31.0,32.0,33.0,34.0,35.0,36.0,37.0,38.0,39.0,40.0,41.0,42.0,43.0,44.0,45.0,46.0,47.0,48.0,49.0,50 .0,51.0,52.0,53.0,54.0,55.0,56.0,57.0,58.0,59.0,60.0,61.0,62.0 [16:45:36.047] DEBUG (sf:oclif:connection): Connection created with apiVersion 62.0 ...
I just refreshed two sandboxes and deleted the auth files. I didn't understand what you want me to try?
I didn't understand what you want me to try?
sorry, I wanted you to follow those steps and share back the logs you get to confirm it's not an issue with your sandbox returning 63.0 from the API (that would mean it's a server error and nothing we can fix from the CLI side).
From looking at the code I can't tell how reusing a username would affect what max API we write to the auth file so it sounds like a server error to me (logs should confirm that)
I didn't understand what you want me to try?
sorry, I wanted you to follow those steps and share back the logs you get to confirm it's not an issue with your sandbox returning
63.0from the API (that would mean it's a server error and nothing we can fix from the CLI side).From looking at the code I can't tell how reusing a username would affect what max API we write to the auth file so it sounds like a server error to me (logs should confirm that)
so, my use case is the following.
I have a sandbox, which is now on preview instance.
I have authorized it and I have it in my sfdx folder.
Now I refresh that sandbox and it becomes on non-preview instance.
I cannot re-auth so I don't have instanceApiVersion and instanceApiVersionLastRetrieved set in the auth file - because when I do not delete the file and reauth again with the same username which I used to have before the sandbox refresh, it has instanceApiVersion and instanceApiVersionLastRetrieved set in the auth file.
If I delete the file manually or delete these pieces after reauth or before reauth, I won't be able to replicate the issue