How can I fix sfdx error: “The \”path\” argument must be of type string. Received type undefined”

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": "",
  "sourceApiVersion": "46.0"

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


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.

Source : Link , Question Author : PatMcClellan__c , Answer Author : PatMcClellan__c

Leave a Comment