Skip to content

sf org create scratch fails with C-1016 when authenticated via External Client App (JWT Bearer Flow) #3515

Open

Description

@cloudconsultants

Summary

sf org create scratch fails with RemoteOrgSignupFailed (error C-1016) when the Dev Hub is authenticated using an External Client App via sf org login jwt. The same command succeeds when authenticated via sf org login web (PlatformCLI).

Since Spring '26, Salesforce disabled creation of traditional Connected Apps by default — only External Client Apps can be created via the UI. This means the documented CI/CD path (sf org login jwt with an External Client App → sf org create scratch) is broken for any org that doesn't have the legacy Connected App org perm enabled by Support.

Steps To Reproduce

  1. Use any SFDX project (e.g., fork dreamhouse-lwc) with a minimal scratch org definition:
{
  "orgName": "Test Scratch Org",
  "edition": "developer",
  "features": ["EnableSetPasswordInApi"],
  "settings": {
    "lightningExperienceSettings": {
      "enableS1DesktopEnabled": true
    }
  }
}
  1. In your Dev Hub org, create an External Client App following the official docs (Create an External Client App in Your Org):

    • Enable OAuth (scopes: api, web, refresh_token/offline_access)
    • Enable JWT Bearer Flow
    • Upload a self-signed certificate (RSA 2048-bit)
    • Callback URL: http://localhost:1717/OauthRedirect
    • Permitted Users: "Admin approved users are pre-authorized"
    • Assign System Administrator profile
  2. Authenticate to the Dev Hub (succeeds):

sf org login jwt \
  --client-id <CONSUMER_KEY> \
  --jwt-key-file server.key \
  --username <USERNAME> \
  --instance-url https://<MYDOMAIN>.my.salesforce.com \
  --alias DevHub --set-default-dev-hub
  1. Create a scratch org (fails):
sf org create scratch \
  --definition-file config/project-scratch-def.json \
  --duration-days 1 --target-dev-hub DevHub

Expected result

Scratch org is created successfully, as it does when the same Dev Hub is authenticated via sf org login web (PlatformCLI).

Actual result

{
  "name": "RemoteOrgSignupFailed",
  "message": "We encountered a problem while attempting to configure and approve the Connected App for your org. Verify the Connected App configuration with your Salesforce admin.",
  "actions": [
    "See https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_scratch_orgs_error_codes.htm for information on error code C-1016."
  ],
  "data": {
    "username": "[email protected]",
    "orgId": "00Dal00001NnHKbEAN",
    "scratchOrgInfoId": "2SRVz0000005UjqOAE"
  },
  "code": "RemoteOrgSignupFailed"
}

Additional information

  • The JWT authentication step itself succeeds — only scratch org creation fails
  • The same Dev Hub + same scratch org definition works perfectly when authenticated via sf org login web (PlatformCLI)
  • Tested on both macOS (local) and Ubuntu (GitHub Actions) — same error on both
  • The scratch org signup process internally tries to replicate/authorize the Connected App into the new scratch org, and this step fails when the auth was done via an External Client App
  • Since Spring '26, the Salesforce docs state: "Creating connected apps is now disabled by default, because connected apps are being deprecated." (ref). This means the only documented CI/CD auth path for new orgs (External Client App + JWT) doesn't work with scratch org creation
  • Our workaround is using sf org login sfdx-url with a stored auth URL from sf org login web, but this has refresh token durability concerns and is not the documented CI approach
  • Salesforce Support Case also open for this org

Shell: zsh (macOS Terminal)

System Information

{
  "architecture": "darwin-arm64",
  "cliVersion": "@salesforce/cli/2.125.2",
  "nodeVersion": "node-v22.22.0",
  "osVersion": "Darwin 25.3.0",
  "rootPath": "/opt/homebrew/Cellar/sf/2.125.2/libexec/lib/node_modules/@salesforce/cli",
  "shell": "zsh",
  "pluginVersions": [
    "@oclif/plugin-autocomplete 3.2.40 (core)",
    "@oclif/plugin-commands 4.1.40 (core)",
    "@oclif/plugin-help 6.2.37 (core)",
    "@oclif/plugin-not-found 3.2.74 (core)",
    "@oclif/plugin-plugins 5.4.56 (core)",
    "@oclif/plugin-search 1.2.38 (core)",
    "@oclif/plugin-update 4.7.19 (core)",
    "@oclif/plugin-version 2.2.36 (core)",
    "@oclif/plugin-warn-if-update-available 3.1.55 (core)",
    "@oclif/plugin-which 3.2.43 (core)",
    "@salesforce/cli 2.125.2 (core)",
    "agent 1.30.6 (core)",
    "apex 3.9.10 (core)",
    "api 1.3.10 (core)",
    "auth 4.1.6 (core)",
    "data 4.0.73 (core)",
    "deploy-retrieve 3.24.11 (core)",
    "info 3.4.105 (core)",
    "limits 3.3.78 (core)",
    "marketplace 1.3.10 (core)",
    "org 5.9.69 (core)",
    "packaging 2.25.5 (core)",
    "schema 3.3.94 (core)",
    "settings 2.4.57 (core)",
    "sobject 1.4.84 (core)",
    "telemetry 3.8.0 (core)",
    "templates 56.9.3 (core)",
    "trust 3.7.114 (core)",
    "user 3.6.52 (core)"
  ]
}

Activity

  1. added
    investigating
    on Mar 5, 2026
  2. github-actions commented on Mar 5, 2026

    @github-actions

    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.

  3. added
    validated
    on Mar 5, 2026
  4. WillieRuemmele commented on Mar 5, 2026

    @WillieRuemmele
    Member

    Hi @cloudconsultants - the scratch org creation team is aware of this issue, and have provided us with the current workaround/information

    if you need org create/delete/refresh scratch/sandbox commands should stay on connected apps. Starting on Spring '26, you do need to open a support case to re-enable connected app creation in your devhub(s).
    if don't use the mentioned commands above, you should be able to use sf with an org auth'd via an ECA

    so it sounds like you'll need to reach out and open a case to reenable this for now

  5. JulianKloosterhuis commented on Mar 12, 2026

    @JulianKloosterhuis

    I encountered the same issue. Is there an update to the case mentioned above?

  6. cloudconsultants commented on Mar 12, 2026

    @cloudconsultants
    Author
  7. added
    announcement
    on Mar 25, 2026
  8. Goobles commented on May 8, 2026

    @Goobles

    Having the same problems here
    we are managing access for our developers to 100+ orgs automatically through scripting, passwordless, so sf org login web is not an option for us. Also we are using multiple external client apps to be able to revoke access given to a user that connects with this org using the sf cli after the fact.

    This problem makes scratch org development impossible for us and makes it so the opsec team has to create sandboxes and scratch orgs for the eng team beforehand, the eng's can't self service because of this

  9. vikyaiyer1997-xen commented on May 19, 2026

    @vikyaiyer1997-xen

    Following up on this issue for further updates. Is it really necessary to create a Connected App given that it is being deprecated? Also, is there any tentative timeline for when the external client app will start supporting scratch org creation?

  10. rondinardo commented on Jun 15, 2026

    @rondinardo

    This has been open three months and still no fix? @WillieRuemmele can you please give us more information? It's getting ridiculous at this point.

  11. mrdailey99 commented on Jun 25, 2026

    @mrdailey99

    We are also facing this issue after switching to ECAs and authenticating using JWT Bearer flow. Intermittently the sf org login jwt command will pass, but then always fails at the sf org create scratch step in our CI workflow. We've tried with different versions of node, 20, 22, and 24.

  12. Goobles commented on Jun 25, 2026

    @Goobles

    I made a case with sf support to reenable Connected App creation for all the 60 production orgs we manage. That solved it for us. (until they fix this command to not depend on ConnectedApps)

  13. JonnyPower commented on Jun 29, 2026

    @JonnyPower

    echo this - frustrating to say the least - pretty huge gap that appears to have no progress for months.

  14. AdamOfHyrule commented on Jul 15, 2026

    @AdamOfHyrule

    Also getting the same issue with ECAs and all good on connected apps. Unable to migrate scratch org creation and passwordless entry over to ECAs without this working

  15. joeyweaver commented on Jul 22, 2026

    @joeyweaver

    Same issue here — ECA + JWT bearer, sf org login jwt succeeds, sf org create scratch fails with C-1016 every time.

    Since this has been open a while, sharing what actually worked for us rather than another +1.

    Root cause, as far as I can tell: Proxy Signup replicates the session's Connected App into the new scratch. When the Dev Hub session is an ECA there's nothing equivalent to replicate, so signup dies. The CLI always derives the signup app from the session, so there's no flag to influence it.

    Workaround: skip the CLI for the signup step and insert the ScratchOrgInfo record directly, pinning the signup app to Salesforce's own built-in CLI app:

    POST /services/data/v67.0/sobjects/ScratchOrgInfo
    {
      "Edition": "Developer",
      "DurationDays": 1,
      "ConnectedAppConsumerKey": "PlatformCLI",                        // <-- the bit that matters
      "ConnectedAppCallbackUrl": "http://localhost:1717/OauthRedirect" // required alongside it
    }

    Both fields are required together — send the consumer key without the callback URL and the insert fails with REQUIRED_FIELD_MISSING [ConnectedAppCallbackUrl].

    PlatformCLI already exists in every org, so Proxy Signup only ever references it and never tries to create anything — C-1016 can't fire. Then poll ScratchOrgInfo.Status until Active and exchange the returned AuthCode for the scratch's own tokens against client_id=PlatformCLI (public client, redirect_uri=http://localhost:1717/OauthRedirect).

    Worth saying why this works, because it isn't really a trick: the ScratchOrgInfo API requires the signup app to be named explicitly, so it can never inherit the session's app the way sf org create scratch does. The CLI just doesn't expose a way to say it.

    Verified end to end on exactly the setup in this issue's title — same org, same user, same Dev Hub, same JWT-bound ECA session. The only variable is how the signup app is supplied:

    Path Signup app Result
    Control sf org create scratch implicit, from the session ❌ C-1016 — the exact banner reported here
    Treatment pinned ScratchOrgInfo insert explicit: PlatformCLI ✅ Status = Active, usable scratch + tokens

    Net effect: you keep the ECA + JWT service credential on the Dev Hub — no sf org login web, no user-bound refresh token sitting in a secret — and scratch creation works. That combination is otherwise impossible today, which I think is what @Goobles and @mrdailey99 are blocked on.

    Two other things that cost us time and might save someone else some:

    1. sf org delete scratch has the same Connected App dependency. Deleting the ActiveScratchOrg record over REST sidesteps it, so CI teardown keeps working.
    2. On an External Client App the JWT certificate upload is not in OAuth Settings. It's under Flow Enablement → Enable JWT Bearer Flow → Certificate Upload, further down the same page. There's no "Use digital signatures" checkbox like a classic Connected App has, and no certificate field is exposed on any ExtlClntApp* Tooling object — so it can look like ECAs don't support JWT at all when they do.

    Working implementation here — MIT, zero dependencies, with GitHub Actions workflows (provision → deploy → test → teardown) and a mock-based test harness so you can try it without touching an org:

    https://github.com/Amphora-AI/eca-scratch

    To be clear, this is a workaround, not a fix. Decoupling signup from the session isn't a documented API, and if Proxy Signup changes it breaks. A support case per Dev Hub still isn't realistic at any scale — several people in this thread are managing dozens to hundreds of orgs — so a real fix would still be very welcome.

    @WillieRuemmele — would exposing the signup Connected App as a flag on sf org create scratch be something the team would consider? It looks like it would unblock this thread without waiting on full ECA support in Proxy Signup.

  16. 2 remaining items

  17. added
    bug
    on Jul 22, 2026
  18. git2gus commented on Jul 22, 2026

    @git2gus

    This issue has been linked to a new work item: W-23543471

  19. WillieRuemmele commented on Jul 22, 2026

    @WillieRuemmele
    Member

    We've published a pre-release build you can test against your ECA + JWT Dev Hub setup:

    sf plugins install @salesforce/plugin-org@eca

    This adds support for two environment variables:

    # Required — tells scratch org signup to use PlatformCLI instead of deriving from the ECA session
    export SF_SCRATCH_SIGNUP_CONNECTED_APP=PlatformCLI
    
    # Optional — override the callback URL (defaults to http://localhost:1717/OauthRedirect which should work for most setups)
    # export SF_SCRATCH_SIGNUP_CALLBACK_URL=http://localhost:1717/OauthRedirect

    To test:

    1. Install the pre-release plugin:

      sf plugins install @salesforce/plugin-org@eca
    2. Set the env var and run your normal scratch org create:

      export SF_SCRATCH_SIGNUP_CONNECTED_APP=PlatformCLI
      sf org create scratch -f config/project-scratch-def.json -v MyDevHub -y 1
    3. Verify delete also works:

      sf org delete scratch -o <scratch-username> --no-prompt

    The env vars are intentionally temporary — once the platform handles ECA replication natively these become no-ops. Priority order for the consumer key is: --client-id flag > SF_SCRATCH_SIGNUP_CONNECTED_APP env var > hub session clientId > PlatformCLI default.

    @joeyweaver — would appreciate a run through your standing ECA + JWT setup if you get a chance. Both the create and delete paths would be great to confirm.

  20. AdamOfHyrule commented on Jul 22, 2026

    @AdamOfHyrule

    Great work so far chaps. I just tried it out but not working for me

    Installed pre release
    @salesforce/cli: Installing plugin org@eca... installed v5.11.23-eca.0

    ECA Setup: JWT, scopes: api, web, refresh, permission set bound (Admin approved users), callback: http://localhost:1717/OauthRedirect
    Authenticated default devhub succssfully with ECA client id: sf org login jwt --set-default-dev-hub

    1st Try (No env)

    sf org create scratch -y 1 --edition developer
    Error
    Error (RemoteOrgSignupFailed): We encountered a problem while attempting to configure and approve the Connected App for your org. Verify the Connected App configuration with your Salesforce admin.

    I see an Error on the ScratchOrgInfo - C-1016

    ────────────── Creating Scratch Org ──────────────

    ✔ Prepare Request 67ms
    ✔ Send Request 10.78s
    ◯ Wait For Org - Skipped
    ✔ Available 7ms
    ✘ Authenticate 4ms
    ◼ Deploy Settings
    ◼ Done

    2nd Try (with env)

    SF_SCRATCH_SIGNUP_CONNECTED_APP=PlatformCLI sf org create scratch -y 1 --edition developer

    Error
    Error (NamedOrgNotFoundError): No authorization information found for <DevHub username>.

    ────────────── Creating Scratch Org ──────────────

    ✔ Prepare Request 540ms
    ✘ Send Request 3.88s
    ◼ Wait For Org
    ◼ Available
    ◼ Authenticate
    ◼ Deploy Settings
    ◼ Done

    Request Id: ✘
    OrgId: ✘
    Username: ✘
    Elapsed Time: 4.44s

    Despite the error, I see an Active ScratchOrgInfo record in the system - But the CLI is not authenticated with the new org

  21. WillieRuemmele commented on Jul 22, 2026

    @WillieRuemmele
    Member

    @HyruleConsulting we've published an updated build with the fix:

    sf plugins install @salesforce/plugin-org@eca

    Then:

    export SF_SCRATCH_SIGNUP_CONNECTED_APP=PlatformCLI
    sf org create scratch -f config/project-scratch-def.json -v MyDevHub -y 1

    This should now work through the full cycle — signup, auth, settings deployment, and subsequent token refreshes. Delete should also work since it operates on the Dev Hub's existing connection (no signup flow involved).

    SF_SCRATCH_SIGNUP_CALLBACK_URL is also available if you need to override the callback (defaults to http://localhost:1717/OauthRedirect which should be fine for most setups).

    Let us know how it goes.

  22. AdamOfHyrule commented on Jul 22, 2026

    @AdamOfHyrule

    Test Setup

    sf plugins install @salesforce/plugin-org@eca --> installed v5.11.23-eca.1
    sf org login jwt --set-default-dev-hub ...

    Can confirm Callback URL on ECA is http://localhost:1717/OauthRedirect

    Test 1 (With Env Variable)

    SF_SCRATCH_SIGNUP_CONNECTED_APP=PlatformCLI sf org create scratch -y 1 --edition developer

    Outcome : Scratch Org Info Status = Active + CLI Error - see below
    ────────────── Creating Scratch Org ──────────────

    ✔ Prepare Request 55ms
    ✔ Send Request 10.92s
    ◯ Wait For Org - Skipped
    ✔ Available 4ms
    ✘ Authenticate 4ms
    ◼ Deploy Settings
    ◼ Done

    Request Id: ***
    OrgId: ***
    Username: ***
    Elapsed Time: 11.00s

    Error (NamedOrgNotFoundError): No authorization information found for ***.

    Test 2 (without Env variable)

    sf org create scratch -y 1 --edition developer

    Outcome: Scratch Org Info Status = Error + CLI Error - see below

    ────────────── Creating Scratch Org ──────────────

    ✔ Prepare Request 48ms
    ✘ Send Request 2.97s
    ◼ Wait For Org
    ◼ Available
    ◼ Authenticate
    ◼ Deploy Settings
    ◼ Done

    Request Id: ✘
    OrgId: ✘
    Username: ✘
    Elapsed Time: 3.03s

    Error (RemoteOrgSignupFailed): We encountered a problem while attempting to configure and approve the Connected App for your org. Verify the Connected App configuration with your Salesforce admin.

  23. WillieRuemmele commented on Jul 22, 2026

    @WillieRuemmele
    Member

    @HyruleConsulting - thanks for the testing, and sorry it's failing... I think I found the issue 🤞 I'm publishing another plugin-org@eca, should be eca.2 - if you can try again, that'll be great! Please use the --dev-debug flag if it doesn't work so I can trace it through, and see if this env var override approach will fully work

  24. joeyweaver commented on Jul 22, 2026

    @joeyweaver

    I'll be able to pick up some testing and provide feedback this evening

  25. mark-ramsell commented on Jul 22, 2026

    @mark-ramsell

    Also testing

  26. AdamOfHyrule commented on Jul 22, 2026

    @AdamOfHyrule

    No problem at all @WillieRuemmele

    Test Setup

    sf plugins install @salesforce/plugin-org@eca --> installed v5.11.23-eca.2
    sf org login jwt --set-default-dev-hub ...

    Test 1 (With env variable)

    SF_SCRATCH_SIGNUP_CONNECTED_APP=PlatformCLI sf org create scratch -y 1 --edition developer

    Outcome: successful Scratch org (PASS).
    ScratchOrgInfo.AuthCode != null
    ScratchOrgInfo.ConnectedAppConsumerKey = PlatformCLI

    Test 2 (without env variable)

    sf org create scratch -y 1 --edition developer

    Outcome: CLI error (C-1016) (PASS - Expected due to platform limitation )

    ────────────── Creating Scratch Org ──────────────

    ✔ Prepare Request 48ms
    ✘ Send Request 4.34s
    ◼ Wait For Org
    ◼ Available
    ◼ Authenticate
    ◼ Deploy Settings
    ◼ Done

    Request Id: ✘
    OrgId: ✘
    Username: ✘
    Elapsed Time: 4.42s

    Error (RemoteOrgSignupFailed): We encountered a problem while attempting to configure and approve the Connected App for your org. Verify the Connected App configuration with your Salesforce admin.

    Great progress. I think the 2nd test is expected to be a CLI failure correct? I presume omitting the env variable/--client-id flag means the consumer key from the JWT auth is parsed and as I understand from the previous analysis in the comments - there is a limitation on the platform with regards to ECAs.

    Thanks so much for your effort thus far

  27. mark-ramsell commented on Jul 22, 2026

    @mark-ramsell

    Setup: GitHub Actions (self-hosted runner), Dev Hub on prod, authenticated via sf org login jwt with an External Client App consumer key. CLI @salesforce/[email protected], plugin pinned by exact version in the workflow.

    eca.1 (5.11.23-eca.1) — same result as @HyruleConsulting: with SF_SCRATCH_SIGNUP_CONNECTED_APP=PlatformCLI, signup succeeded (ScratchOrgInfo → Active) but the create failed at Authenticate:

    NamedOrgNotFoundError: No authorization information found for <devhub-username>
        at AuthInfo.loadDecryptedAuthFromConfig (.../core/lib/org/authInfo.js:783)
        at AuthInfo.initAuthOptions (.../core/lib/org/authInfo.js:728)
        at async authorizeScratchOrg (.../core/lib/org/scratchOrgInfoApi.js:179)
        at async scratchOrgCreate (.../core/lib/org/scratchOrgCreate.js:176)
    

    eca.2 (5.11.23-eca.2) — ✅ working end-to-end on the ECA + JWT path. Same pipeline, only the pin changed:

    • sf org create scratch --definition-file ... --target-dev-hub <jwt-authed hub> → created and authenticated (our pipeline then continued through package installs against the new org, so token refresh worked too)
    • sf org delete scratch on the same org → clean delete, no leaked slot

    Thanks @WillieRuemmele — this unblocks our weekly scratch-org bake. One request: when this graduates from the @eca dist-tag, a note here would be appreciated so CI pins can move to the stable release.

  28. WillieRuemmele commented on Jul 22, 2026

    @WillieRuemmele
    Member

    Thanks for all the testing @mark-ramsell / @HyruleConsulting , and for digging in @JonnyPower !!! - yes, now that we've confirmed this is working, and fixing pipelines, we'll work on merging this changes into latest, we'll post back here, and of course, give everyone a shoutout in the release notes!


    also, note, this is just a workaround solution, the real solution is still being worked on and understood internally

  29. azanatta commented on Sep 29, 2026

    @azanatta

    29 September '26, issue is still happening.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    announcementbuginvestigatingvalidated

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions