Skip to content
Latchkey

sfdx "force:source:deploy is deprecated, use sf project deploy" in CI

The old sfdx force:* topics are deprecated in favor of the new sf command tree. CI still running sfdx force:source:deploy prints a deprecation warning and, once the command is removed, fails outright. Migrate to sf project deploy start.

What this error means

A step using sfdx force:source:deploy prints "The command "force:source:deploy" has been deprecated and will be removed" or fails as not found after a CLI upgrade.

sfdx
Warning: The "force:source:deploy" command has been deprecated. Use "project deploy start" instead.

Common causes

Pipelines still call legacy sfdx force commands

Scripts written for the old CLI use sfdx force:source:deploy and similar, which the unified sf CLI deprecates and eventually removes.

A CLI upgrade dropped the old command

After updating to a CLI version that removed the deprecated topic, the old command is no longer recognized.

How to fix it

Switch to the sf command tree

  1. Replace sfdx force:source:deploy with sf project deploy start.
  2. Update related commands (force:org:create, force:apex:test:run) to their sf equivalents.
  3. Pin the CLI version so the command set is predictable.
Terminal
# old
sfdx force:source:deploy -p force-app -u ci-org
# new
sf project deploy start --source-dir force-app --target-org ci-org

Pin the CLI version in CI

Install a known CLI version so an unexpected upgrade does not remove a command mid-pipeline.

Terminal
npm install --global @salesforce/cli@2

How to prevent it

  • Migrate pipelines from sfdx force:* to the sf command tree.
  • Pin the CLI version so command availability is deterministic.
  • Watch CLI release notes for deprecations before they become removals.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →