Troubleshooting
Diagnose cache, database, module, and rendering issues in production.
Quick health checks #
| Tool | What it tells you |
|---|---|
./velvet diagnose |
Cache read/write status, storage permissions, DB connectivity, active content driver, module count. Use --json for machine parsing. |
storage/logs/*.log |
Hook your PSR-3 logger here (default is NullLogger, so wire Monolog or your observability provider during bootstrap). |
storage/modules-compiled.json |
Confirms which modules compiled successfully and the order they’ll load. |
storage/modules-autoload.php |
Ensures namespace → path mappings exist; delete + rerun module:compile if corrupt. |
Cache weirdness #
- Delete
storage/cache/*withvelvet cache:clear. This nukes config and route cache too, so re-runconfig:cache+route:cacheafterward. - If Markdown output looks stale, make sure
content.markdown.cache_ttlisn’t gigantic and thatpage.save/deleteevents are firing (modules can listen and flush tags viaCacheTagManager).
Database & migrations #
- Use
migrate --path=...to re-run a single module’s migrations. The runner reports every file (before/after/error callbacks) so you can see exactly where it failed. - If
diagnosereports DB failures, confirm.envcredentials and that your PHP extension (pdo_mysql,pdo_pgsql, etc.) is loaded.
Module issues #
- Run
module:listto confirm the manifest is discoverable. module:enable foo+module:compilewhenever you editmodule.jsonor add dependencies.- If the app reports “entry class not found,” inspect
composer.jsoninside the module and ensure the namespace matches theentryvalue. - Version skew?
./velvet versionprints module versions + constraints so you know what to upgrade.
Routing & HTTP #
- Delete
storage/cache/routes.phpif you think route cache is stale; the front controller will fall back to dynamic registration. - Set
APP_DEBUG=truetemporarily (in staging) to see the formatted HTML/JSON exception page generated byVelvetCMS\Exceptions\Handler.
Content pipeline #
- The
page:list --status=draftcommand is the fastest way to confirm a page exists and has the expected status. - Switch
CONTENT_DRIVERtofile(in.env) locally to reproduce driver-specific issues, then back toautoorhybridfor production.
When in doubt, clear caches, recompile modules, and rerun diagnose—it covers 90 % of operational hiccups.