forcedotcom / forcedotcom/cli

sf org create scratch fails JWT for preview release with "External client app is not installed in this org"

Open
#3,638 5 comments 1 reaction 0 assignees View on GitHub
investigating validated
Dominant language
No language data
Stars
571
Forks
80
Avg merge
2d 15h
Merged PRs (30d)
3

Description

> **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 `doctor` command 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

creating a scratch org with `release: preview` fails

Seems related to https://github.com/forcedotcom/cli/issues/3515#issuecomment-5051285103, but creating this separately as it works with current release but not on preview

### Steps To Reproduce

1. auth dev hub with JWT via an ECA
2. attempt to create scratch org with `"release": "preview",`
3. See failure.

Does not fail with no release key set

### Expected result
sf org create scratch creates preview scratch org when using JWT auth with dev hub

### Actual result

```
@{name=JwtAuthError; message=Error authenticating with JWT.
Errors encountered:
External client app is not installed in this org
External client app is not installed in this org
user hasn't approved this consumer
External client app is not installed in this org
External client app is not installed in this org; exitCode=1; context=OrgCreateScratch; stack=JwtAuthError: Error authenticating with JWT.
Errors encountered:
External client app is not installed in this org
External client app is not installed in this org
user hasn't approved this consumer
External client app is not installed in this org
External client app is not installed in this org
at SfCommandError.from (file:///opt/hostedtoolcache/node/24.19.0/x64/lib/node_modules/@salesforce/cli/node_modules/@salesforce/sf-plugins-core/lib/SfCommandError.js:48:16)
at OrgCreateScratch.catch (file:///opt/hostedtoolcache/node/24.19.0/x64/lib/node_modules/@salesforce/cli/node_modules/@salesforce/sf-plugins-core/lib/sfCommand.js:333:47)
at OrgCreateScratch._run (/opt/hostedtoolcache/node/24.19.0/x64/lib/node_modules/@salesforce/cli/node_modules/@oclif/core/lib/command.js:187:29)
at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
at async Config.runCommand (/opt/hostedtoolcache/node/24.19.0/x64/lib/node_modules/@salesforce/cli/node_modules/@oclif/core/lib/config/config.js:389:25)
at async run (/opt/hostedtoolcache/node/24.19.0/x64/lib/node_modules/@salesforce/cli/node_modules/@oclif/core/lib/main.js:97:16)
at async file:///opt/hostedtoolcache/node/24.19.0/x64/lib/node_modules/@salesforce/cli/bin/run.js:15:1; cause=undefined; warnings=System.Object[]; code=JwtAuthError; status=1; commandName=OrgCreateScratch}
```

### Additional information

### System Information

```json

{
"architecture": "linux-x64",
"cliVersion": "@salesforce/cli/2.149.9",
"nodeVersion": "node-v24.19.0",
"osVersion": "Linux 6.17.0-1022-azure",
"rootPath": "/opt/hostedtoolcache/node/24.19.0/x64/lib/node_modules/@salesforce/cli",
"shell": "bash",
"pluginVersions": [
"@oclif/plugin-autocomplete 3.2.56 (core)",
"@oclif/plugin-commands 4.1.63 (core)",
"@oclif/plugin-help 6.2.58 (core)",
"@oclif/plugin-not-found 3.2.93 (core)",
"@oclif/plugin-plugins 5.4.87 (core)",
"@oclif/plugin-search 1.2.54 (core)",
"@oclif/plugin-update 4.7.59 (core)",
"@oclif/plugin-version 2.2.57 (core)",
"@oclif/plugin-warn-if-update-available 3.1.73 (core)",
"@oclif/plugin-which 3.2.61 (core)",
"@salesforce/cli 2.149.9 (core)",
"agent 2.0.3 (core)",
"apex 4.1.0 (core)",
"api 2.0.9 (core)",
"auth 5.0.6 (core)",
"data 5.1.5 (core)",
"deploy-retrieve 4.1.2 (core)",
"info 4.0.9 (core)",
"limits 4.0.3 (core)",
"marketplace 2.0.5 (core)",
"org 6.0.9 (core)",
"packaging 3.0.5 (core)",
"schema 4.0.5 (core)",
"settings 3.0.5 (core)",
"sobject 2.0.5 (core)",
"telemetry 4.0.5 (core)",
"templates 57.0.9 (core)",
"trust 4.0.9 (core)",
"user 5.0.1 (core)"
]
}
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing `sf org create scratch` with JWT authentication, an ECA, and `"release": "preview"`; compare it with the current-release and no-release cases. Review the related issue 3515 comment and the `OrgCreateScratch` entry point. Done means preview scratch-org creation succeeds with JWT authentication without regressing the other cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js
Domain
authentication, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.