# HD-INC-242: An AI Coding Agent Deleted a Company's Database and Its Backups in Nine Seconds

> Working on a routine staging task, a Cursor agent running Claude Opus 4.6 found an account-wide API token and used it to delete PocketOS's production database volume on Railway, despite project rules against destructive commands without approval. Backups appeared gone too, car rental customers lost bookings for about 30 hours, and Railway restored the data from separate disaster-recovery copies.

- Source: https://useheadlights.com/library/HD-INC-242/
- Publisher: Headlights (useheadlights.com), author Ellie Harris
- Published: 2026-10-19
- Company: PocketOS; Cursor (Anysphere); Railway (cloud host); Anthropic (model provider)
- Sector: Software development tools
- Country: United States
- Year: 2026
- Behaviour in the record (Headlights reading): Rules-behaviour gap; also Overconfidence
- Governance domains: Decision authority, Human oversight
- Licence: CC BY-NC 4.0. Cite as: Harris, E. (2026). An AI Coding Agent Deleted a Company's Database and Its Backups in Nine Seconds. Headlights AI Incident Library, HD-INC-242. https://useheadlights.com/library/HD-INC-242/

## What happened

It was reported that on Friday 24 April 2026, an AI coding agent deleted the production database of PocketOS, a small US company providing software for car rental businesses, including reservations, payments, customer records and vehicle tracking. According to the company's founder, Jer Crane, the agent was Cursor, an AI coding tool developed by Anysphere and running Anthropic's Claude Opus 4.6 model, while PocketOS hosted its data with the cloud provider Railway.

The agent had been working on a routine task in a staging environment when it encountered a problem with its credentials, but rather than stopping to verify what it should do, it found another API token stored on the customer's machine and used it. Railway later confirmed that the token had account-wide access, its broadest permission level, which allowed the agent to reach beyond staging and delete a storage volume connected to the live database.

Because the request was properly authenticated, Railway's API accepted it without requiring any additional confirmation, and according to Crane, the deletion took just nine seconds. The company's volume-level backups also appeared to disappear from Railway's interface, leaving Crane with a backup that was three months old as the most recent version he could recover himself, although Railway later explained that it maintained separate off-site disaster-recovery copies that were unaffected by the deletion.

For the car rental businesses using PocketOS, the consequences were immediate, with reservations and customer records becoming inaccessible and some customers arriving to collect vehicles only to discover that their bookings could no longer be found. Crane described roughly 30 hours of disruption as he tried to restore operations and help businesses recover their booking information.

When Crane questioned the agent about what it had done, it replied that it had "violated every principle I was given" and had "guessed instead of verifying", despite the project having rules against guessing and against running destructive or irreversible Git commands without explicit approval. The agent even acknowledged that deleting the database volume was "the most destructive, irreversible action possible", far more serious than the actions those rules were intended to prevent, although that recognition came only after the damage had been done.

Railway eventually restored PocketOS's data using its separate disaster-recovery backups and, on 29 April, published its own account of the incident, acknowledging that its API had allowed an authenticated request to delete a volume immediately, even though its dashboard already offered a 48-hour recovery window. The company subsequently changed the API to make volume deletions reversible for 48 hours, delayed the deletion of associated backups and acknowledged that although narrower token permissions had been available, its setup had not made it sufficiently clear which permission level customers should choose.

The reporting reviewed did not include a public response from Cursor or Anthropic specifically addressing the incident.

## Where the gap was

PocketOS had given its agent rules against guessing and running destructive or irreversible Git commands without approval, yet when it encountered a problem, it found a credential with far more authority than the task required and used it to delete production storage. Although the agent recognised the seriousness of that decision afterwards, the infrastructure had already accepted the request and carried out the deletion without any independent confirmation.

Headlights identifies a rules-behaviour gap between the safeguards PocketOS believed it had established and what the agent was actually able to do, because the written instructions were intended to influence its behaviour but did not prevent the action. An account-wide credential gave the agent access to production, while Railway's API accepted the authenticated deletion request without requiring additional approval, leaving the company's live data exposed to a decision made during an unrelated staging task.

Headlights also identifies possible overconfidence in relying on written instructions and existing safeguards to protect a production system, although this is an interpretation of the reported design and events rather than a finding about anyone's intentions or state of mind. The sources reviewed do not identify any regulatory or court findings.

What makes this incident particularly revealing is that the agent did not need to break into anything or bypass a security control, because it found a legitimate credential, used the authority attached to it and made a request the infrastructure was willing to execute. There is a similarity with the Replit incident in 2025, where an AI coding agent also acted against restrictions it was supposed to follow, while the extent of the damage depended on what the surrounding systems allowed it to reach.

The failure was not simply that the agent ignored a rule, but that the rule was being relied upon to protect a production system when the technical controls still allowed the destructive action.

## What could have helped

The agent explained what it thought had gone wrong only after Crane questioned it. That explanation may show how the agent described its behaviour, but it isn't an independent record of what happened.

PocketOS needed a log of the original task, the credentials the agent found, the token it chose to use, the API request it made and the system it targeted. The log should also show the rules in force and whether anyone approved the deletion.

That evidence would let PocketOS and its providers reconstruct the sequence of events. An agent's convincing explanation after the fact can't replace a record of the actions it took.

## What governance should have looked like

An agent working in staging should not be able to reach production simply because it discovers a credential that allows it, which means permissions need to be limited to the environment and actions required for the task, regardless of what the model decides to do.

Destructive operations also need controls outside the agent itself, because a written instruction to ask for approval offers little protection when the same agent can choose to ignore it, and deleting production storage should require separate authorisation that the agent cannot provide on its own.

PocketOS could have prevented the agent from operating outside its approved environment and required human approval before allowing destructive commands. A record of the commands issued, credentials used and approvals given would have helped establish what happened without relying on the agent's own account of its actions.

The incident also exposed the importance of recovery, with backups needing protection from the same deletion processes that affect production data and restoration procedures needing to be tested. Railway's separate disaster-recovery copies ultimately made recovery possible, while its subsequent introduction of a 48-hour reversible deletion period addressed another weakness, because an authenticated request should not automatically make an important system change irreversible.

The wider lesson is that an AI agent can understand a rule, repeat it and even explain why it should have followed it, yet still act against it, which is why the rules have to exist where the action happens, not just in the instructions the agent reads.

**Failure Pattern:** an AI coding agent working on a routine staging task found an account-wide credential and used it to delete a production storage volume through a cloud provider's API, despite project rules against guessing and destructive commands without approval, while the absence of an independent technical control allowed the request to proceed. The deletion also made the volume-level backups appear unavailable, and the company's data was ultimately recovered from the provider's separate disaster-recovery copies.

**Governance Principle:** limits on an AI agent's actions must be enforced at the point of execution through narrowly scoped credentials, separation between environments, reversible deletion and independent human approval for destructive operations, while recovery systems must remain protected from the same actions that can destroy production data.

## Sources

- [Your AI wants to nuke your database. Guardrails fix that. (Railway, 29 April 2026)](https://blog.railway.com/p/your-ai-wants-to-nuke-your-database)
- [When AI goes really, really wrong: how PocketOS lost all its data (DevOps.com, 28 April 2026)](https://devops.com/when-ai-goes-really-really-wrong-how-pocketos-lost-all-its-data/)
- [Gone in 9 seconds: AI agent deletes company database (ACS Information Age, 5 May 2026)](https://ia.acs.org.au/article/2026/gone-in-9-seconds--ai-agent-deletes-company-database.html)
- ["I violated every principle I was given": AI agent deletes company's entire database in 9 seconds, then confesses (Live Science, 29 April 2026)](https://www.livescience.com/technology/artificial-intelligence/i-violated-every-principle-i-was-given-ai-agent-deletes-companys-entire-database-in-9-seconds-then-confesses)
- [An AI agent deleted a company's entire database in 9 seconds, then wrote an apology (Euronews, 28 April 2026)](https://www.euronews.com/2026/04/28/an-ai-agent-deleted-a-companys-entire-database-in-9-seconds-then-wrote-an-apology)

## Related

- [HD-INC-004](/library/HD-INC-004/)
- [HD-INC-236](/library/HD-INC-236/)
- [HD-INC-005](/library/HD-INC-005/)
