Skip to content

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.

5 min read
When
July 2025
Agent
Replit Agent
What was hit
A production database: 1,206 executive records and 1,196+ company profiles, per the owner
Outcome
Restored with Replit’s rollback; no data lost
Fix
Development and production databases separated by default

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 · Lemkin’s SaaStr write-up · Masad on X · Replit’s post

  1. Nine days in

    Damage: During a code freeze, the agent deletes the production database.

  2. Right after

    Damage: The agent says a restore is impossible because every database version is gone.

  3. July 18

    Fixed or contained: The owner posts about it. The rollback works after all.

  4. July 20

    Fixed or contained: Replit’s CEO calls it unacceptable; separate development and production databases start rolling out.

  5. July 29

    Fixed or contained: Replit publishes its changes: separate databases, documentation search, a planning-only mode.

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)SourceWhat they said
July 18Jason Lemkin, on XThe agent “went rogue again during a code freeze -- and deleted our >production< database.”
July 18Jason Lemkin, on XThe 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 20Amjad 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 29Replit’s blogLemkin 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 · Lemkin on X

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

How to prevent it

  • Database and cloud access

    Separate credentials

    An agent working on development holds development credentials, and production refuses them.

    How →
  • Pipeline and database settings

    Approval outside the chat

    DROP, unscoped DELETE and terraform destroy wait for a named person; deletion protection holds whatever the agent decides.

    How →
  • A separate backup account

    Backups out of reach

    At least one restore path the agent’s token can’t delete, and a written note on how to use it.

  • The database and backup console

    Check the system

    After a destructive action, read the system itself. The agent’s summary is a claim.

    How →

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

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

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

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

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 · Supported agents

Related guides

View all