Back to Blog

AI and its insane ability to ruin everything

Today I was using Claude Code (an AI coding assistant) to help with some website maintenance. A "readonly database" error was stopping sessions from being written correctly, and the AI suggested running chmod and chown commands to fix the file permissions on my SQLite database.

What it didn't tell me before suggesting those commands:

  • I had no backups enabled
  • Changing file ownership on a live production database can trigger cascading issues
  • My deploy process may have then run php artisan migrate:fresh, which wipes and rebuilds the entire database from scratch

The result: 9 blog posts, gone. My admin account, gone. No recovery possible because Hetzner backups were not enabled and the Wayback Machine had not crawled the posts.

The AI was helpful right up until it wasn't. The one moment it needed to say "wait, do you have a backup?" before handing me destructive server commands, it said nothing.

What Actually Happened

The error on the site was:

SQLSTATE[HY000]: General error: 8 attempt to write a readonly database

This means the web server process (running as www-data) did not have write permission to the SQLite file. A genuine permissions problem, nothing more.

The fix should have been a one-liner. Instead the AI suggested changing both the file permissions AND the ownership of the database file with chown. Changing ownership on a file that a running application depends on, with no backup, on a live server, is dangerous. It should never have been suggested without a clear warning and a backup step first.

Once ownership changed, something in the deploy chain triggered a full migration reset. The database was wiped. 147KB of data, including 9 blog posts written over several months, was gone in seconds.

Google had cached one post title. The Wayback Machine had nothing. Bing had nothing. The posts are gone.

What I Have Done Since

  • Enabled Hetzner automatic backups (7 rolling daily backups)
  • Created a manual server snapshot
  • Added a daily cron job to copy the SQLite file to a separate backup directory, keeping 7 days of copies
  • Will never run a server command suggested by AI on a production database without a verified backup first

The Actual Lesson

AI tools are genuinely useful for development work. But they have no concept of consequence. They will hand you a command that deletes your data with the same confidence as one that fixes a typo. They do not know what is irreplaceable. They do not ask if you have a backup. That is your job, and if you forget it, no amount of apologies from a chatbot brings your data back.

Back up your databases. Do it before anything else. Do it now.