Skip to content

sf org list excludes scratch org entry linked via org login web #3439

@sirephil

Description

@sirephil

Summary

A colleague created a scratch org and I've been logging in to it to create some flows and the like using a secondary admin user (with username and password defined and used for login). I now need to retrieve metadata from the org, but I'm having trouble setting up the CLI connection.

When using sf org login web authentication, this is what I see on the CLI:

% sf org login web -a LIScratch7696bi2 -r https://redacted-dev-ed.scratch.my.salesforce.com/  
Successfully authorized [email protected] with org ID 00DEm00000XXXXXXXX

However, running sf org list fails to show this connection. That said, if I explicitly look to display the org details, I see:

% sf org display --target-org LIScratch7696bi2 --verbose

Org Description
┌─────────────────┬─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ KEY             │ VALUE                                                                                                                                                                   │
├─────────────────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Access Token    │ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX                                                        │
│ Alias           │ LIScratch7696bi2                                                                                                                                                        │
│ Api Version     │ 65.0                                                                                                                                                                    │
│ Client Id       │ PlatformCLI                                                                                                                                                             │
│ Created By      │ [email protected]                                                                                                                                                 │
│ Created Date    │ 2025-10-14T09:23:23.000+0000                                                                                                                                            │
│ Dev Hub Id      │ [email protected]                                                                                                                                     │
│ Edition         │ Developer                                                                                                                                                               │
│ Expiration Date │ 2025-11-13                                                                                                                                                              │
│ Id              │ 00DEm00000XXXXXXXX                                                                                                                                                      │
│ Instance Url    │ https://redacted-dev-ed.scratch.my.salesforce.com                                                                                                                       │
│ Namespace       │ XXXXXXXXXX                                                                                                                                                              │
│ Org Name        │ Dev org                                                                                                                                                                 │
│ Sfdx Auth Url   │ force://PlatformCLI::XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX@redacted-dev-ed.scratch.my.salesforce.com                  │
│ Signup Username │ [email protected]                                                                                                                                           │
│ Status          │ Active                                                                                                                                                                  │
│ Username        │ [email protected]                                                                                                                                             │
└─────────────────┴─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

Steps To Reproduce

  1. Create a scratch org (with a namespace in my case) on one machine.
  2. Set up a second System Administrator user.
  3. Obtain the scratch org URL and replace ".lightning.force.com" with ".my.salesforce.com".
  4. On another machine, run the sf org login web command to set up a connection to this org using the adjusted URL and the credentials for the second System Administrator user.
  5. Run the sf org list command.

NB: The repository content is irrelevant. All you need is:

  1. A common dev hub shared between the two users/machines.
  2. A scratch org created against that on one machine.
  3. A secondary admin account, the credentials for which are used on a second machine to do the login via the sf CLI.

Expected result

When listing orgs, the new connection appears in that list.

Actual result

The org and alias are not shown.

System Information

This happens when running on Windows 11, powershell, and via the Illuminated Cloud 2 IDE.

{
  "architecture": "win32-x64",
  "cliVersion": "@salesforce/cli/2.109.7",
  "nodeVersion": "node-v20.19.5",
  "osVersion": "Windows_NT 10.0.22631",
  "rootPath": "C:\\Users\\redacted\\AppData\\Roaming\\npm\\node_modules\\@salesforce\\cli",
  "shell": "powershell",
  "pluginVersions": [
    "@oclif/plugin-autocomplete 3.2.35 (core)",
    "@oclif/plugin-commands 4.1.33 (core)",
    "@oclif/plugin-help 6.2.33 (core)",
    "@oclif/plugin-not-found 3.2.68 (core)",
    "@oclif/plugin-plugins 5.4.48 (core)",
    "@oclif/plugin-search 1.2.32 (core)",
    "@oclif/plugin-update 4.7.8 (core)",
    "@oclif/plugin-version 2.2.33 (core)",
    "@oclif/plugin-warn-if-update-available 3.1.48 (core)",
    "@oclif/plugin-which 3.2.40 (core)",
    "@salesforce/cli 2.109.7 (core)",
    "agent 1.24.13 (core)",
    "apex 3.8.3 (core)",
    "api 1.3.3 (core)",
    "auth 3.9.17 (core)",
    "code-analyzer 5.2.2 (user) published 127 days ago (Tue Jun 24 2025) (latest is 5.6.1)",
    "data 4.0.58 (core)",
    "deploy-retrieve 3.23.3 (core)",
    "info 3.4.88 (core)",
    "limits 3.3.67 (core)",
    "marketplace 1.3.8 (core)",
    "org 5.9.32 (core)",
    "packaging 2.20.5 (core)",
    "schema 3.3.82 (core)",
    "settings 2.4.48 (core)",
    "sobject 1.4.73 (core)",
    "telemetry 3.6.58 (core)",
    "templates 56.3.65 (core)",
    "trust 3.7.113 (core)",
    "user 3.6.38 (core)",
    "sfdmu 4.38.0 (user) published 304 days ago (Sun Dec 29 2024)"
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue or pull request that identifies or fixes a bugvalidatedVersion information for this issue has been validated

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions