The file can’t be deleted. Warning!unlink: No such file or directory error from the Admin

This article provides a solution to the issue where you see an error The file can’t be deleted. Warning!unlink: No such file or directory error from the Commerce Admin when you do a JavaScript/CSS flush.

Affected products and versions

  • Adobe Commerce 2.4.0 - 2.4.6, all deployment methods

Issue

An error occurs when you do a JS/CSS flush:

The “/app/pub/static/_cache/merged/.nfsa42d0e64799fd1000000001b” file can’t be deleted. Warning!unlink(https://experienceleague.adobe.com/app/pub/static/_cache/merged/.nfsa42d0e64799fd1000000001b?lang=en): No such file or directory

Or: You see the above error in the Admin, and/or a similar error in New Relic or in the deployment logs.

Or: You are unable to access Advanced Reporting, and the analytics_collect_data cron job is failing with this error:

The “/app/var/tmp/analytics/tmp/.nfsb3b6041dd44588a0000850c0” file can’t be deleted. Warning!unlink(https://experienceleague.adobe.com/app/var/tmp/analytics/tmp/.nfsb3b6041dd44588a0000850c0?lang=en): No such file or directory

Steps to reproduce:

Method 1:

  1. Log in to the Admin.
  2. Go to System > Cache Management.
  3. Click Flush JavaScript/CSS Cache.

Method 2:

  1. Log in to the Admin.
  2. Go to Stores > Settings > Configuration.
  3. Make changes to the Base URL or Base URL (Secure).
  4. Click on Save Config.

Solution

If you are on Adobe Commerce on Cloud infrastructure and have magento/magento-cloud-patches 1.0.22 installed which include the patch, you do not need to separately install ACSD-50165.

Adobe Commerce on Cloud infrastructure: Upgrade Cloud Patches for Commerce to 1.0.22 (or newer) which contains this fix: Cloud Patches for Commerce.

Adobe Commerce on-premises: Apply ACSD-50165 using Quality Patches Tools > Usage. The ACSD-50165 patch comes with QPT v1.1.30.

recommendation-more-help
8bd06ef0-b3d5-4137-b74e-d7b00485808a