Fixing failing composer patches by updating GNU Patch


If you have certain older versions of Git and GNU Patch installed, composer patches may silently fail to apply.

This bug may be experienced if you are running either of the following:

  • A version of Patch prior to 2.7.5, or
  • A version of composer-patches prior to 1.6.4

The error message below is a common manifestation of this issue in Lightning:

Configuration objects (,, media.type.image) provided by lightning_media_image already exist in active configuration



If you are requiring Lightning 3.0.0, you can check whether you are affected by testing for the presence of a file in core which would be missing if patches aren’t applying properly. 

1. Check your lightning version:

composer info acquia/lightning | grep version

2. Check for a missing file:

if [ -e "docroot/core/modules/media/config/install/" ]; then echo "Affected"; else echo "Not affected"; fi


If you are affected, you will need to upgrade some combination of Patch/GPatch and Git. We suggest checking your installed versions and if outdated, updating to the following versions or later: 

$ git --version
git version 2.15.1

$ patch --version | grep patch
patch 2.5.8

$ brew info gpatch | grep "gpatch:"
gpatch: stable 2.7.5 (bottled)

You can also resolve this issue by updating to the latest release of composer-patches, 1.6.4.

Once you've upgraded run:

rm -rf docroot/core && composer install

Then run the check command again to check the issue is resolved: 

if [ -e "docroot/core/modules/media/config/install/" ]; then echo "Affected"; else echo "Not affected"; fi


Acquia BLT and Lightning both use the composer-patches package to allow you to apply patches to Drupal modules and core via your composer.json file. Composer patches currently has a bug that causes it to silently fail to apply patches when you run composer install. This bug is only triggered when you have certain versions of Git and Patch and installed. To ensure your system is not affected by this bug, make sure you have Patch version 2.7.5 or greater, which is known to work regardless of your Git version.

The current release of composer patches (1.6.4)  resolves this bug, regardless of your Git or Patch version. BLT will require the fixed version of composer-patches as soon as it's available, and will add a version check as a safeguard in the meantime.

This bug produces no immediate errors (composer patches fails silently), but causes very strange and hard-to-diagnose behaviors later on.


Contact supportStill need assistance? Contact Acquia Support