I'm getting an error similar to this post and I've checked to see if I could resolve it in the same way, but it appears to be a different issue.

Whenever I try to push, deploy or convert to metadata, I'm getting the error

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined

This error also shows up in the Problems tab in VS Code, but clicking on it gives me another error (Unable to open "": File is a directory.)

enter image description here

This issue was reported on the github/cli forum by others over the last 8-9 months, but there's no clear resolution. I've added more detail (json error output) there.

The only "path" argument I can find is in the sfdx-project.json, and it's clearly a string:

  "packageDirectories": [{ "path": "force-app", "default": true }],
  "namespace": "",
  "sfdcLoginUrl": "https://login.salesforce.com",
  "sourceApiVersion": "46.0"

I'm completely stuck with no clear way to debug this. Would appreciate any ideas...

  • Did you try creating a new scratch org to target?
    – Phil W
    Commented Aug 9, 2019 at 6:02
  • It won't let me even convert to mdapi where no org is involved. Something is internally off with the source. Commented Aug 9, 2019 at 6:10
  • 1
    I'm thinking the error message is just wrong, and there may be an errant remnant from the merge conflict resolution. I'm currently searching for things like <<<<< HEAD etc. Also combing through the .forceignore file. Commented Aug 9, 2019 at 15:49
  • Very helpful answer to similar issue (link) Commented Sep 21, 2023 at 15:52

5 Answers 5


FIXED IT! I found that I could do a sfdx force:source:deploy -p [filepath] on individual files and on directories. So, I started at the top and worked my way down.

sfdx force:source:deploy -p force-app/main/default = same error

sfdx force:source:deploy -p force-app/main/default/applications = success

sfdx force:source:deploy -p force-app/main/default/appMenus = success

sfdx force:source:deploy -p force-app/main/default/aura = success

sfdx force:source:deploy -p force-app/main/default/classes = success

...etc., until sfdx force:source:deploy -p force-app/main/default/staticResources = SAME ERROR

So I stepped into that directory and discovered a meta file for a graphic (png) that was missing. I pulled the png from my other files (not in the project), added it to the directory, then did...

sfdx force:source:deploy -p force-app/main/default/staticresources = SUCCESS

So then, I tried sfdx force:source:push and SUCCESS!


  1. That error message is not at all helpful and appears to occur when there's a variety of errors in the package you're trying to push.
  2. If you can still use deploy (I could), start at the top and work your way down until you can isolate the directory/file where the error originates.
  • Very helpful! I had the exact same issue and this approach helped me diagnose it. Commented Nov 20, 2019 at 21:04
  • I had the same error after I accidentally copied a "Object" folder into the parent directory. Additional help for anybody debugging this: delete the scratch cache in .sfdx/orgs/[email protected] after you fixed the folder structure. Commented Dec 9, 2019 at 15:23
  • Do you have to use " these " or nah ? Or these ' ' you didn't use them I tried all three and none worked.
    – MadMax
    Commented Feb 13, 2021 at 20:50
  • I just used the cli with no single or double quotes. The only quotes in this post are about the path file, which ended up not being significant. No changes to that. Commented Feb 13, 2021 at 21:13
  • For us, the inclusion of object translations cause sfdx to choke and throw this error. We had to remove them and reset everything in ~/.sfdx/ Commented Jan 5, 2022 at 14:36

This can happen if you put an object definition into a folder that SFDX doesn't recognize. For example, this happened to me when i put a Custom Metadata definition in a folder labelled 'customMetadata' (it expected a folder called 'objects', apparently).


According to me, There must be an invalid static resource. Please verify your static resource files.


I had the same issue, but it was related to copy & paste file, when vsc added " copy" to the file name. Agree that error message should be better.

  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented May 16, 2022 at 10:49

I have package xml built with all the files. I tried several changes like deleting all the files from project and retrieving them again. Not sure what exactly worked, but it worked after I restarted closed and reopened vscode

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .