[SalesForce] ERROR running force:source:delete – The delete operation failed in the org. Review the error messages below

I am trying to delete an Aura Component by right clicking on the file contents and selecting:

SFDX: Delete This from Project and Org

But it's not working…

I get this message in the output panel:

Starting SFDX: Delete from Project and Org

sfdx force:source:delete –sourcepath c:\path\file.cmp –noprompt

ERROR: The delete operation failed in the org. Review the error messages below, delete any files locally if needed, and re-run the command if applicable.

ERROR running force:source:delete: The delete operation failed in the org. Review the error messages below, delete any files locally if needed, and
re-run the command if applicable.

sfdx force:source:delete –sourcepath c:\path\file.cmp –noprompt ended with exit code 1

But there is no error message below to review.

The file is not referenced in any other files.
All other related aura files have been deleted, there is only the .cmp and .cmp-meta.xml

Why won't it delete?

Best Answer

The CLI sometime can be buggy to show the errors . I had issues last week and got resolved when i updated the CLI using sfdx update

The salesforce deployment status would give much better error . Go to Deploy > Deployment Status in your org when you execute command to see if there are any failures during that .

Also it could be way the vscode extension is issuing the command it might not revealing much error

Manually in your terminal run below

sfdx force:source:delete --sourcepath c:\path\file.cmp --noprompt --loglevel=ERROR --json
Related Topic