function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Anthony Wheeler 11Anthony Wheeler 11 

force:source:deploy: Unexpected Arguments

I'm attempting to set up Bitbucket pipelines for our Salesforce development process. Due to multiple managed packge dependencies and standard settings that are unable to be migrated, I'm opting to run test validations in Sandboxes as opposed to Scratch orgs. Installation and Authentication are working great, however once it gets to the deployment step, it throws the following error:

ERROR running force:source:deploy: Unexpected arguments: -c, --testlevel, RunLocalTests
See more help with --help


Here's the relevant segment of the pipeline
 
#Assign variables 
- export CLIURL=https://developer.salesforce.com/media/salesforce-cli/sfdx-linux-amd64.tar.xz  
- export SFDX_AUTOUPDATE_DISABLE=false
 - export SFDX_USE_GENERIC_UNIX_KEYCHAIN=true
- export SFDX_DOMAIN_RETRY=300
- export SFDX_DISABLE_APP_HUB=true
- export SFDX_LOG_LEVEL=DEBUG
- export ROOTDIR=force-app/main/default/
#Create sfdx directory
- mkdir sfdx
#Install Salesforce CLI
- wget -qO- $CLIURL | tar xJ -C sfdx --strip-components 1
- "./sfdx/install"
- export PATH=./sfdx/$(pwd):$PATH
- sfdx --version
- sfdx plugins --core
#Authorize UAT
- sfdx force:auth:jwt:grant --clientid $UAT_CONSUMER_KEY --jwtkeyfile assets/server.key --username $UAT_USERNAME --setalias UAT --setdefaultusername --instanceurl https://test.salesforce.com
#Runs tests
- echo "Running Tests"
- sfdx force:source:deploy -c --testlevel RunLocalTests --sourcepath $ROOTDIR --targetusername UAT --wait 10

​​​​​​​
Best Answer chosen by Anthony Wheeler 11
Anthony Wheeler 11Anthony Wheeler 11
The Salesforce CLI version on the URL for Linux installation is not up to date. I added 'sfdx update' post installation in the pipeline, and my deploy command worked.

All Answers

Anthony Wheeler 11Anthony Wheeler 11
The Salesforce CLI version on the URL for Linux installation is not up to date. I added 'sfdx update' post installation in the pipeline, and my deploy command worked.
This was selected as the best answer
Jaap ScheperJaap Scheper
Got the same error. Cause was that I used --testLevel instead of the correct capitalization --testlevel