---
title: Filesystem Write Errors
description: "## Symptom When you try to activate a snippet, you see a generation error such as \"Cannot create directory\" or \"Failed to write generated file.\" Or you see this as a persistent admin notice: \"GOCSM cannot write generated snippet files.…"
url: "https://brightleafdigital.io/docs/filesystem-write-errors/"
updated: "2026-10-20"
category: GravityOps Code Snippet Manager / Troubleshooting
---

# Filesystem Write Errors

## Symptom

When you try to activate a snippet, you see a generation error such as "Cannot create directory" or "Failed to write generated file."

Or you see this as a persistent admin notice: "GOCSM cannot write generated snippet files. Snippet file generation is unavailable until wp-content/uploads/gocsm/ is writable."

## Check the diagnostics

Go to **Settings**. **Runtime diagnostics** shows "Generated files writable". If it shows **No**, the directory is not writable. The value comes from the last time the plugin was activated, so after fixing the problem, deactivate and reactivate the plugin to run the check again.

## Common causes

### Incorrect file permissions

The `wp-content/uploads/` directory must be writable by the web server user (typically `www-data` or `nginx`).

```
# Check current permissions
ls -la wp-content/uploads/

# Fix permissions if needed
chown -R www-data:www-data wp-content/uploads/gocsm/
chmod -R 755 wp-content/uploads/gocsm/
```

### Managed hosting restrictions

Some managed WordPress hosts (WP Engine, Kinsta, Pantheon) restrict PHP file writes to the uploads directory for security. Contact your host to ask whether PHP-generated files in `wp-content/uploads/` are supported.

If your host does not allow it, enable **Eval fallback mode** in Settings. Set it to **Auto** so GOCSM falls back to eval when PHP file generation fails. In the current implementation, **Always** also permits eval fallback but still attempts file generation first during activation.

### SELinux or AppArmor

On hardened Linux systems, SELinux or AppArmor may block the web server from writing to uploads. Check your audit log:

```
ausearch -m avc -ts recent
```

## Using eval fallback

See [Eval Fallback Mode](../05-advanced/02-eval-fallback-mode.md) for full details. Note that eval fallback has performance and debuggability trade-offs.
