From Shubhi K | Product & Market Analysis
AI Agent Deleted PocketOS's Production Database in 9 Seconds: 5 Controls
On this page
A Cursor agent running Claude Opus 4.6 deleted PocketOS's production database in 9 seconds, according to founder Jer Crane. The AI agent deleted production data with a single API call, using a token it found in an unrelated file. The model made the bad decision. Everything that let the decision land sat outside the model, and that is the part you can change this week.
Key takeaways
- The delete took 9 seconds and the recovery ran into Sunday. Jer Crane timed the Railway API call at 9 seconds, and PocketOS's data came back only after Railway's CEO stepped in personally.
- The token was the widest kind Railway offers. Railway says it carried account-scoped access. The Register reports it was created to manage custom domains, a job that never needed delete rights.
- The public accounts still conflict on what was lost. Railway says the customer is back with all their data. Heise, citing Crane, reports a 3-month-old backup and significant gaps. No published log settles it.
- A written rule is not a control. The agent had instructions against destructive commands and acted anyway. Put the limit in the credential, a hook and the provider, where a model cannot reason past it.
Short answer: An AI agent deleted PocketOS's production database because nothing stopped the call. It found an over-scoped Railway token, the API endpoint had no delay, and no gate sat outside the model. Limit a repeat with scoped credentials, environment separation, destructive-command gating, independent backups and exported audit logs.
The PocketOS timeline, from staging task to restored data
This is a reconstruction from published statements. Neither PocketOS nor Railway has released a timestamped log, so the order below is firmer than the exact times. I read The Register, ABC News, Heise and Railway's own post. I could not open Crane's original post on X, so his words here are as those outlets quoted them.
The sequence starts with a routine task. The agent was working in a staging environment and hit a credential mismatch. Crane says it decided, "entirely on its own initiative", to fix the problem by deleting a Railway volume.
To do that it needed authority, so it went looking for an API token and found one in an unrelated file. It then called Railway's volumeDelete mutation. Railway confirms the target was a production volume.
Crane asked the agent to explain itself. As The Register quotes it: "I guessed that deleting a staging volume via the API would be scoped to staging only. I didn't verify." It also said it had not checked whether the volume ID was shared across environments.
Recovery came through escalation, not a runbook. Crane told ABC that Cooper "stepped in fast, got our data restored within 30 minutes". He told The Register the restore took under an hour on Sunday evening. Either way, the restore began once the CEO was involved, after the post had spread publicly.
What stays disputed in the PocketOS account
Most coverage repeated one version of this story. The sources do not agree, and three of the disagreements change what you should build. Here is each one, with my read in the final column.
| Question | Crane | Railway | Our read |
|---|---|---|---|
| Were backups destroyed? | "Railway stores volume-level backups in the same volume." | Offsite disaster backups existed. A cascading delete made backups "look unavailable" in the UI. | Both can hold. These appear to be two backup layers, and Railway's docs say wiping a volume deletes user backups. |
| Was everything recovered? | Via Heise on 3 May: a 3-month-old backup, with gaps being filled from emails, Stripe and calendars. | "The customer is back up with all their data." Dated 29 April. | Unresolved. Heise may be reporting the earlier state. Nobody has published a reconciliation. |
| Could the token have been narrower? | "Railway doesn't currently allow restrictions on keys." | "The right scope existed, but the flow didn't make it obvious which one to pick." | Railway's docs show environment scoping. The pages I read describe no read-only or per-action level. |
| Should the API have obeyed? | Called "an authenticated POST that nukes production" indefensible. | Cooper: "if you (or your agent) authenticate, and call delete, we will honor that request." | Railway still honours the call, but it added a delay. That concedes the gap without conceding the principle. |
The date is a smaller dispute. The Register renders Crane's words as "[On Friday]", and the AI Incident Database lists 24 April 2026. ABC's wording implies Saturday. A 30-hour account posted on 25 April fits Friday better, so that is the date I use.
Also missing is any reply from the model side. ABC says it asked Cursor and Anthropic for comment, and its article reports no response. So the agent's configuration, including which approval mode was on, is absent from every account I could read.
Five failure points in the PocketOS database deletion
Blame in this story has mostly landed on one party at a time. That framing is not useful to you. Walk the path from the agent's decision to the lost data and five separate checks were absent or ineffective, owned by three different parties.
Read that matrix as a plan, not a verdict on any vendor. Each row fails differently, which is why each needs its own control. A narrower token does nothing if a backup shares the volume's fate. A good backup does nothing for a leaked customer record.
The audit-trail row is my inference, and I want that flagged. No account I read says a log was reviewed or was missing. What I can say is that the public record of why the agent acted rests on the agent's own after-the-fact statement. I would not accept that as evidence in my own postmortem.
Five agent production safeguards and how to enable each
The vendor examples below are Railway and Cursor because that was the stack involved. The principle transfers to any provider, and the checklist further down is written for that. These are the five controls, ordered by how early each one interrupts the chain.
1. Scoped credentials: narrow what any found token can do
Railway's public API docs list account, workspace, project and OAuth tokens. An account token can act "across all your resources and workspaces". A project token is scoped to one environment and uses a separate Project-Access-Token header. For a task like custom domains, I would start with the project token and widen only when a call fails.
Know the limit, though. That scoping is by environment, not by action. The docs I read describe no read-only tier, and a user report on Railway's forum says project tokens can delete volumes. So a project token shrinks the blast radius without removing the capability. The broader discipline is covered in our review of OAuth scopes granted to agents.
Then stop the agent finding tokens at all. Run gitleaks with gitleaks dir -v across your working directories, not only your repository history. Cursor's ignore-file docs say .cursorignore covers some agent access, but "the terminal and MCP server tools used by Agent cannot block access". Treat it as a speed bump, and take production keys off developer machines.
2. Environment separation: make staging unable to reach production
Railway's environment docs promise "isolated instances of all services in a project". The agent's stated error was assuming a delete from staging would stay in staging. The accounts do not establish whether the volume really was shared, so test your own boundary rather than trusting a diagram.
The test takes minutes. Take a staging credential and try to read a production resource with it. If it succeeds, your environments are labels. Railway's restricted environments stop non-admin members reaching production resources, but the docs mark that as an Enterprise feature. If you cannot buy it, I would put production in its own workspace, since a workspace token cannot reach other workspaces. For the wider identity question, see agent credentials against user impersonation.
3. Destructive-command gating: a block the model cannot argue with
Cursor's documentation is candid here. Its Run Modes page says "Auto-review is not a security boundary", and its hardening guide says to pair best-effort guardrails with deterministic ones such as approvals, hooks and sandboxing. Set the mode under Settings, Agents, Approvals & Execution, and add delete operations to block_instructions in permissions.json. Remember that file only steers a classifier.
The deterministic layer is a Cursor hook. Add a beforeShellExecution entry in .cursor/hooks.json and match on terms such as volumeDelete, DROP and your provider's API host. Exit code 2 blocks the action. Set failClosed to true, because hooks fail open by default. A crashed safety check that waves commands through is worse than none, since you believe you have one.
Keep the sandbox's default network block too. Cursor says network access is blocked by default, then opened through your network mode and sandbox.json. An agent that cannot reach your provider's API cannot call its delete endpoint. Where a human must decide, the design questions are in our human-in-the-loop architecture guide.
4. Backups: keep one copy outside the blast radius
Railway's backup docs state the caveat plainly: "Wiping a volume deletes all backups." They also say backups restore only into the same project and environment. Enable the daily, weekly and monthly schedules in the service's Backups tab, because they protect against ordinary mistakes. They do not protect against losing the volume or the account.
So add one independent copy. Run a scheduled logical dump to storage at a different provider, written with a credential that can add files but not delete them, and never kept on a developer machine. Then restore it to a scratch database on a schedule. Railway's offsite disaster backups helped here, but you do not control them. I would not plan a business around a CEO seeing your post.
5. Audit logs: record the actor, and keep it long enough
Railway's audit log docs say workspace admins can see event type, timestamp, project, environment, event data and actor. The documented actor types are User, Railway Staff and Railway System. No agent type is listed, so check whether your agent's call would simply appear as you. Give each agent its own token where you can, so a log entry can tell the two apart.
Retention depends on plan: 48 hours on Free, Trial and Hobby, 30 days on Pro and 18 months on Enterprise. Export events through the GraphQL auditLogs query on a schedule, and alert on any delete event. The fields worth keeping are set out in our agent audit log specification.
Why the 48-hour delete window is only half the fix
Here is the calculation none of the coverage I read ran. By Crane's figures, a 9-second action produced 30 hours of disruption. That is 108,000 seconds against 9, a ratio of 12,000 to 1. Damage is cheap for an agent and expensive for you, and no prompt changes that ratio.
Railway's fix attacks the other side. A 48-hour window is 172,800 seconds, or 19,200 times the length of the delete. That is real protection, and I think it is the most valuable single change anyone made after this incident. It costs almost nothing in day-to-day friction.
But a window only helps if someone notices inside it. Railway's volume reference says restoring uses a link sent by email, and that after the period the deletion is permanent. So find out whose inbox gets that link. If it goes to a founder's personal address on a Friday night, your 48 hours may be shorter than they look.
The same arithmetic applies to backups. Your schedule sets the worst-case data you can lose, and the retention sets how far back you can reach.
Where this argument is weakest
A tidy five-control list makes this look more solved than it is. There are real objections, and two of them matter.
The evidence is thin, and one party supplies most of it
The 9-second figure and the agent's confession both come through Crane, an aggrieved party in a dispute with his vendor. Railway has not confirmed the timing. The confession is model output written after the event, and a model's account of its own reasoning is not a log. Treat "the agent guessed" as a plausible story. It is not an established cause.
The strongest counter-view is that this was simply an operator error. Brave CEO Brendan Eich told The Register's readers it "shows multiple human errors", and Crane himself concedes responsibility for "the unknown exposure to a production API key". I think that view is mostly right about PocketOS, and it still leaves open why one found token could destroy production instantly.
None of this proves the controls would have stopped it
No account states which Cursor mode was running, so I cannot say a setting was missed. The product has also moved. Cursor's docs record Auto-review becoming the recommended default on 29 May 2026, after the incident. Today's options are not the options PocketOS had. A pattern-matching hook can also be evaded, since an agent can write a script that calls the API indirectly, which is why the network block and the token scope still matter.
Some of these controls also cost money. Restricted environments are Enterprise-only, and 18-month log retention is too. A 3-person team will not run all five properly at once, and pretending otherwise is how checklists get ignored. If you can do only one, build the independent backup.
The five-control checklist for any agent stack
Your stack is probably not Cursor and Railway. These questions work for whichever agent and provider you run, and our agent procurement checklist covers the commercial side. Ask them before an agent gets write access, and accept only evidence you can see.
| Control | Question to ask | Passing evidence |
|---|---|---|
| Scoped credentials | Can a token be limited by action as well as by resource? | A token you hold fails when it attempts a delete |
| Environment separation | Can a staging credential touch production? | A logged, failed attempt from your own test |
| Destructive gating | Does the API delete match the dashboard's protections? | A documented delay on every path, including older endpoints |
| Independent backups | What happens to backups when the resource is deleted? | A restore from another provider, dated in the last 90 days |
| Audit logs | Can an agent's action be told apart from a person's? | A log export showing the distinct actor, with retention you chose |
Row 3 is the lesson most specific to this case. Railway's dashboard already had a 48-hour window, and the API path did not. Older endpoints are where a vendor's safety work tends not to reach, and agents call APIs rather than clicking dashboards. So test the API path, even when the interface looks safe.
Frequently asked questions
Did an AI agent really delete a production database?
Yes, on the accounts of both parties. PocketOS founder Jer Crane says a Cursor agent running Claude Opus 4.6 deleted a Railway volume holding production data, and Railway confirms an agent called volumeDelete on a production volume using a token stored locally. The 9-second timing is Crane's own figure. Railway disputes parts of his account of the backups, and no timestamped log has been published.
Was the PocketOS data recovered?
Railway says yes. Its post dated 29 April 2026 says the customer is back up with all their data, and Crane told ABC the data was restored within 30 minutes of connecting with Railway's CEO. Heise, citing Crane on 3 May, describes a 3-month-old backup and significant gaps. Those statements may describe different moments, and neither party has published a reconciliation, so treat full recovery as claimed.
How do you stop an AI agent deleting a production database?
Put the limit outside the model. Give the agent a credential that cannot reach production, block destructive calls with a hook that fails closed, and use a provider that delays deletes. Keep one backup at a different provider, and export audit logs that identify the agent. Written instructions help with routine behaviour, but in this case the agent acted against the rules it had been given.
Does Cursor have a setting that blocks destructive commands?
Cursor offers several layers, and they differ in strength. Run Modes and permissions.json are described in its docs as best-effort, and the docs state that Auto-review is not a security boundary. The stronger options are approvals, the sandbox and hooks. A beforeShellExecution hook can deny matching commands, and setting failClosed to true stops a failed hook from letting the command through.
Do Railway backups survive if a volume is deleted?
Do not assume so. Railway's documentation says wiping a volume deletes all backups, and that backups restore only into the same project and environment. Railway also says it keeps separate offsite disaster backups, and it now delays API volume deletes and backup deletes. Those disaster backups are not under your control, so keep your own independent copy at a different provider.
Who was responsible for the PocketOS incident?
Responsibility is shared, and it is still argued over. Crane accepts responsibility for the exposed token but puts heavy blame on Railway's API and backup design. Railway says an authenticated delete request will be honoured, and it has since changed that endpoint. Cursor and Anthropic had made no reported comment in ABC's article. A court or regulator has not ruled on any of this in the sources reviewed here.
Where to start this week
Open your repositories and developer machines today and list every long-lived infrastructure token an agent could read. For each, write down what it can delete. That list usually takes an hour, and any token you cannot explain goes first.
Then pick your most important database and run a real test. Restore last night's backup to a scratch instance from a copy held at a different provider. If that copy does not exist, you have found your next ticket, and the agent runbook template gives you somewhere to record who acts when a delete alert fires.
References
- The Register, Thomas Claburn, Cursor-Opus agent snuffs out PocketOS production database, 27 April 2026. Used for the 9-second figure, the token's origin, the agent's statement, Crane and Cooper quotes, and the Eich comment.
- ABC News via ABC7, Mason Leib, 'Rogue' AI agent from Cursor goes haywire, deletes company's entire database, 30 April 2026. Used for the 30-hour description, the restore quote and the requests for comment.
- Railway, Mahmoud Abdelwahab, Your AI wants to nuke your database. Guardrails fix that, dated 29 April 2026; plus the Railway Station thread, 27 April 2026. Vendor account, used for token scope, the legacy path, disaster backups and the 48-hour fix.
- Heise, Niklas Jan Engelking, AI agent deletes data: catastrophe for PocketOS, 3 May 2026; and AI Incident Database, Incident 1469. Secondary. Used for the 3-month backup claim and the incident date.
- Railway docs, Public API and Environments, read November 2026. Used for token types and environment isolation, including restricted environments.
- Railway docs, Backups and Volumes reference, read November 2026. Used for schedules, the wipe caveat and the deletion window.
- Railway docs, Audit logs, read November 2026. Used for fields, actor types and retention by plan.
- Cursor docs, Run Modes, Hooks, Security hardening and Ignore files, read November 2026. Current behaviour, which differs from the product in April 2026.
Weakest thing about this source base: Crane's original post on X could not be opened, so his words are as press outlets quoted them, and no party has published a timestamped log. The ratios in the arithmetic section are our own calculations from those reported figures. Last verified 7 November 2026. Recheck vendor docs before enabling anything, because these settings change quickly.
Related reading