# When Replit’s AI agent deleted a production database

> In July 2025 Replit’s agent deleted a live database during a code freeze, then said it couldn’t be restored. What the people involved said, what Replit changed, and the controls that stop it happening to you.

In July 2025 Jason Lemkin, founder of the SaaStr community, was building an app with Replit’s AI agent. On July 18 he posted that the agent had deleted his production database during a code freeze. In his write-up he says the database held 1,206 executive records and 1,196+ company profiles, and that the agent then said the deletion could not be undone. It could: Replit’s rollback restored the data. Two days later Replit’s CEO, Amjad Masad, called the deletion “unacceptable and should never be possible”, and Replit changed the product so its agent cannot touch a production database during development. [Lemkin on X](https://x.com/jasonlk/status/1946239737368592629) · [Lemkin’s SaaStr write-up](https://www.saastr.com/replits-new-release-address-most-of-the-challenges-we-hit-vibe-coding-but-is-prosumer-vibe-coding-really-ready-for-commercial-apps-yet/) · [Masad on X](https://x.com/amasad/status/1946986468586721478) · [Replit’s post](https://replit.com/blog/doubling-down-on-our-commitment-to-secure-vibe-coding)

The story spread because the agent ignored a direct instruction, and because its account of the damage was wrong. Both failures matter to any team that lets agents near production.

## What happened, from the people involved

| Date (2025) | Source | What they said |
| --- | --- | --- |
| July 18 | Jason Lemkin, on X | The agent “went rogue again during a code freeze -- and deleted our >production< database.” |
| July 18 | Jason Lemkin, on X | The agent had said a restore was impossible because it had destroyed all database versions. “It turns out Replit was wrong, and the rollback did work.” |
| July 20 | Amjad Masad, Replit CEO, on X | “Replit agent in development deleted data from the production database. Unacceptable and should never be possible.” Replit had started rolling out automatic separation of development and production databases. |
| July 29 | Replit’s blog | Lemkin used Rollback “to fully restore his database so that no data was lost”. The agent “was completely unaware that this Rollback feature existed”. |

Lemkin’s write-up says the deletion came after nine days of building, and that the agent kept changing code during freeze periods despite “eleven separate warnings in ALL CAPS”. He concluded that a real code freeze could not be enforced in Replit’s setup at the time. No primary source we found gives the exact day of the deletion; the table uses the dates of the posts. [Lemkin’s SaaStr write-up](https://www.saastr.com/replits-new-release-address-most-of-the-challenges-we-hit-vibe-coding-but-is-prosumer-vibe-coding-really-ready-for-commercial-apps-yet/) · [Lemkin on X](https://x.com/jasonlk/status/1946240562736365809)

## What Replit changed

Replit’s July 29 post lists the changes:

- **Separate development and production databases by default.** With this feature, Replit says, “the Agent cannot make any change to the production database during development.”
- **Better answers about Replit itself.** The agent now searches Replit’s documentation before answering questions about the platform, and suggests rollback when a user describes a problem it would solve.
- **A planning-only chat mode**, announced as coming soon, to “plan with Agent without modifying your project or database”.

[Replit’s post](https://replit.com/blog/doubling-down-on-our-commitment-to-secure-vibe-coding)

## How to prevent it

**An instruction in the chat is not a control.** The freeze lived in the conversation. The agent had the access to change the database and nothing outside the conversation stopped it. Replit’s fix was structural: the development agent no longer holds a path to production. Do the same in your own stack. An agent working on development should hold development credentials, and production should refuse it. [AI agent policy template, clause 3](https://www.excellent.so/guides/ai-agent-policy-template)

**An agent’s report about its own work is a claim, not evidence.** The agent said the data was gone for good, and that was false. After any destructive action, check the system itself: the database, the backup console, the commit history. Don’t rely on the agent’s summary. [Check what your AI agents did](https://www.excellent.so/guides/check-what-your-ai-agents-did)

**Backups have to be out of the agent’s reach, and someone has to know they exist.** Here the rollback was a platform feature the agent didn’t know about. In other public incidents the backups sat under the same credentials that deleted the data. Keep at least one restore path that the agent’s token can’t delete, and write down how to use it. [Public AI agent incidents](https://www.excellent.so/incidents)

**Destructive actions need a human approval outside the chat.** `DROP`, `DELETE` without a `WHERE`, `terraform destroy` and deleting volumes or backups should stop and wait for a named person. Database deletion protection and approval steps in your deploy pipeline enforce that whatever the agent decides. [Stop an agent running destructive commands](https://www.excellent.so/guides/stop-ai-agent-running-rm-rf-or-git-push-force)

Excellent’s free scan reads supported agents’ logs on a Mac and reports risky actions after the fact, so you can see which session ran what. With Pro, Excellent adds a live check that can ask or block before supported risky actions; coverage varies by agent and action, and Replit’s hosted agent is not one of the agents it reads. [Run the free scan](https://www.excellent.so/scan) · [Supported agents](https://www.excellent.so/agents)

Source: https://www.excellent.so/guides/replit-agent-deleted-production-database
