How to fix Magento custom patch throws an error while patch applied?

Magento applies a custom patch with a command line, composer -v install throws an error,

[TypeError]                                                                                                                 
  Composer\Util\RemoteFilesystem::copy(): Argument #1 ($originUrl) must be of type string, null given, called in /var/www/ht  
  ml/vendor/cweagans/composer-patches/src/Patches.php on line 388    
  
          "Patch Call to a member function getCustomer() on null fix": "patches/vendor/rbj/module-customer-feature/Model/Rule/Condition/Customer.patch" IN the class name typo issue.

Here you can’t able to apply the patch and throw an error as mentioned above.

This error comes when you have declared the patch file name in the composer.json with the wrong path.

In my case, it was a typo in the classpath declaration,

"rbj/module-customer-feature": {
    "Patch Call to a member function getCustomer() on null fix": "patches/vendor/rbj/module-customer-feature/Modle/Rule/Condition/Customer.patch"
}

In the above definition, It was Modle instead of Model.

You required like,

"rbj/module-customer-feature": {
        "ISLA-317: Call to a member function getCustomer() on null": "patches/vendor/rbj/module-customer-feature/Model/Rule/Condition/Customer.patch"
}

You need to resolve it by correcting the patch file path name and just retrying to composer -v install works fine.