Fix “Minify error: failed to open stream: No such file or directory” in W3 Total Cache

Seeing “Minify error: failed to open stream: No such file or directory” from W3 Total Cache? That message means the minify engine is trying to read a CSS or JS file from disk, but the file is not where PHP expects it to be. The plugin is asking for a path. PHP looks on the server, finds nothing, and throws the error.

The fix is almost always: make W3TC point at real files again and make sure the minify cache folders exist and are writable. Let’s go through it in a clean, step by step way.

W3 Total Cache is throwing “Minify error: failed to open stream: No such file or directory” for CSS/JS. What does this mean and how do I fix it?

If you’re wondering what’s broken: W3 Total Cache’s minify feature is trying to load a CSS or JS file that your server cannot find at the path it is using.

Why this error shows up

W3 Total Cache “minify” works by reading your CSS and JS files from disk, combining and shrinking them, and then serving a cached version from wp-content/cache/minify/.

When PHP logs something like:

Minify error: failed to open stream: No such file or directory

it means:

  • Minify asked PHP to open a file at a specific path, and
  • that file was not there or not readable.

That usually comes from one of these situations:

  • You removed or updated a theme/plugin and its CSS/JS file path changed, but W3TC is still trying to minify the old path.
  • Your document root or WordPress path is not what W3TC thinks it is, so it builds wrong file paths for minify.
  • The wp-content/cache/minify/ folder is missing or not writable, so W3TC cannot create or read cache files.
  • Less often, a CDN or custom path rewrite is making W3TC construct invalid paths.

We’ll start by finding the exact file that is failing, then branch based on what you find.

Step 1: Find the file that is failing

You need the full error. It usually includes the file path that PHP could not open.

Check your error log or W3TC minify notice

  1. Open your PHP or server error log (or use your host’s “Errors” viewer in the control panel).
  2. Search for “failed to open stream” and “minify”.
  3. Copy the full line. You should see:
    • A path to a CSS or JS file, for example /home/account/public_html/wp-content/themes/your-theme/assets/js/app.js.
    • Or a path under wp-content/cache/minify/, for example /wp-content/cache/minify/1/c1399.css.

If you have W3TC’s Minify error notification turned on, it may also show an admin notice naming the missing file. That is the file we care about.

Check if the file actually exists

  1. Connect over SFTP or open your hosting file manager.
  2. Navigate to the path in the error message.
  3. Answer this question:
    • Case A: The file itself is gone. (You see the folders, but not the file.)
    • Case B: The file is somewhere else. (You can find it, but the path is different from the error.)
    • Case C: The path is under wp-content/cache/minify/ and that file does not exist.

Once you know which case you are in, use the matching fix below.

Case A: The file belongs to a removed or changed theme/plugin

Example: you see an error for wp-content/plugins/old-plugin/assets/js/old.js, but that plugin is gone.

1) Temporarily turn minify off to confirm

  1. In WordPress, go to Performance → General Settings.
  2. Find the Minify section.
  3. Uncheck Enable for Minify.
  4. Scroll down and click Save all settings.
  5. At the top admin bar, click Performance → Purge All Caches.
  6. Reload your site and the error page.

If the error disappears with Minify off, you just proved that W3TC minify is the source.

2) Remove the dead file from your Minify configuration

If you use manual Minify mode:

  1. Go to Performance → Minify.
  2. Scroll to the JS and CSS sections where file lists live.
  3. Find any entry that uses the missing path from the error.
  4. Remove that entry, or update it to the new path if the file moved.
  5. Click Save all settings.
  6. Click Empty cache for Minify (button in the toolbar or on the Minify screen).

If you use auto Minify mode:

  1. Still on Performance → Minify, make sure you have not manually added the missing file anywhere.
  2. Click Save all settings and then Empty cache for Minify.
  3. If the error persists and it always names a file from a deleted theme or plugin, switch Minify mode to manual for JS or CSS, save, then back to auto and save again. This can clear stale entries.

Turn Minify back on in Performance → General Settings, purge caches, and retest.

Case B: The file exists, but the path in the error is wrong

Example: WordPress lives in /public_html/site/, but the error path uses only /public_html/, or you are using symlinked directories.

This usually means W3TC is building paths from the wrong document root.

1) Check how WordPress is installed

  1. In WordPress, go to Settings → General.
  2. Check:
    • WordPress Address (URL)
    • Site Address (URL)
  3. Confirm they match how the site is actually installed. For example:
    • If WordPress is in /public_html/site, URLs should look like https://example.com/site unless you use special rewrites.

If the URLs are wrong, fix them and click Save Changes. Then purge all caches and test again.

2) Try the “Fix document root path” option

W3TC has a setting to help when the server’s document root does not match the actual WordPress path (common with subdirectories, symlinks or some panels).

  1. Go to Performance → General Settings.
  2. Scroll to Miscellaneous.
  3. Toggle Fix document root path:
    • If it is disabled, turn it on.
    • If it is enabled and the error started after that, turn it off.
  4. Click Save all settings.
  5. Click Performance → Purge All Caches.

This tells W3TC to resolve file paths using the absolute WordPress path instead of only the server’s root, which often fixes incorrect minify paths.

If you use symlinked themes or plugins and see path related minify errors, keep in mind that W3TC’s file safety checks can also complain about those. In that case, you may need to exclude those files from minify to keep things simple.

Case C: The path is inside wp-content/cache/minify/ and the file does not exist

Example: the error mentions /wp-content/cache/minify/1/c1399.css and that file is missing.

Here, the problem is usually the minify cache folder itself or permissions.

1) Check the cache folders and permissions

  1. In your file manager or SFTP:
    • Go to wp-content/cache/.
    • Look for a minify folder.
  2. If minify does not exist, create it.
  3. Make sure:
    • wp-content, cache, and minify are owned by the web server user.
    • Folder permissions are typically 755 (or whatever your host recommends).

2) Clear and rebuild the minify cache

  1. In WordPress, go to Performance → Dashboard.
  2. Click Empty all caches.
  3. Go to Performance → Minify and click Empty cache there as well if you see that button.
  4. Load your site in a private window to force W3TC to rebuild minified files.

If permissions and folders are correct, W3TC should now be able to create the missing .css or .js cache files on demand.

If you just want to stop the error right now

If this is a live site and the error is flooding logs or breaking pages, it is fine to turn Minify off while you sort out the root cause.

Quick rollback: disable Minify

  1. Go to Performance → General Settings.
  2. Uncheck Enable under Minify.
  3. Click Save all settings.
  4. Click Performance → Purge All Caches.

Your site will load without minification. Once things are stable, you can turn Minify back on and reintroduce it slowly.

Make Minify stable going forward

Exclude fragile files from Minify

If one specific file or plugin keeps causing minify problems, exclude it.

  1. Go to Performance → Minify.
  2. In the JS and CSS sections, use the Never minify the following or exclusion fields to add:
    • Specific paths that have caused errors, or
    • Handles for problem scripts if W3TC lets you exclude by handle.
  3. Save settings and empty the minify cache.

It is better to leave a few tricky files unminified than to have broken pages or constant “failed to open stream” notices.

Recheck after theme or plugin changes

Any time you:

  • Change themes,
  • Remove big plugins, or
  • Move WordPress to a different folder or domain,

plan to:

  • Purge all W3TC caches.
  • Empty the Minify cache specifically.
  • Visit a few key pages and check the browser console and error logs.

Verification: how to know it is fixed

You are in a good spot when:

  • No new entries in your error log mention Minify error: failed to open stream: No such file or directory.
  • Your pages load with all CSS and JS working and no 404s for /wp-content/cache/minify/ files.
  • W3TC’s Minify section does not show new error notices.

Still stuck?

For AI help

Hit Continue Chat below and send me:

  • The full error line that mentions failed to open stream and the file path.
  • Whether the path in the error points to wp-content/cache/minify/... or to a theme/plugin file.
  • Whether you are using auto or manual Minify mode.

I’ll help you track down the exact file and the cleanest way to fix or exclude it.

For expert human help

Scroll down to the contact form below. Enter your name, email, and WordPress needs. Atiba will get back to you as soon as possible.

Need human WordPress help?

WP Assistant is a free tool created by Atiba Software, a WordPress design and development company located in Nashville, TN. If you need more personalized WordPress assistance let us know, and we’ll get back to you ASAP!