6

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 Aug 9 at 6:02
  • It won't let me even convert to mdapi where no org is involved. Something is internally off with the source. – PatMcClellan__c Aug 9 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. – PatMcClellan__c Aug 9 at 15:49
4

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!

WHAT HAVE WE LEARNED?

  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. – Brian Triplett Nov 20 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/username@example.com after you fixed the folder structure. – J. Lietzau 9 hours ago

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.