---
title: "Friday fun: the AI agent that deleted the database in 9s"
description: A Cursor agent hit a credential error, grabbed an unrelated token, and deleted a production database and all backups in 9 seconds. Then it confessed.
canonical: https://lukeocodes.dev/cursor-agent-deleted-production-database
type: article
locale: en_GB
published: 2026-08-21T00:00:00.000Z
modified: 2026-08-21T00:00:00.000Z
authors:
  - Luke Oliff
section: AI
tags:
  - AI
  - Developer Experience
  - Security
feed: https://lukeocodes.dev/rss.xml
search: https://lukeocodes.dev/search.json?q={query}
schema:
  - "@context": https://schema.org
    "@graph":
      - "@type": Organization
        "@id": https://ably.com/#organization
        name: Ably
        url: https://ably.com
      - "@type": WebSite
        "@id": https://lukeocodes.dev/#website
        url: https://lukeocodes.dev
        name: Luke Oliff
        alternateName: lukeocodes
        inLanguage: en
        publisher:
          "@id": https://lukeocodes.dev/authors/luke#person
        description: Personal blog and writing by Luke Oliff — developer relations, voice AI, developer experience.
        potentialAction:
          - "@type": SearchAction
            target:
              "@type": EntryPoint
              urlTemplate: https://lukeocodes.dev/blog/search?q={search_term_string}
            query-input: required name=search_term_string
      - "@type": Person
        "@id": https://lukeocodes.dev/authors/luke#person
        name: Luke Oliff
        url: https://lukeocodes.dev/authors/luke
        description: Staff engineer and Staff Tech Lead for Developer Experience at Ably. Writing about developer relations, AI, and the voice industry, from the UK.
        mainEntityOfPage: https://lukeocodes.dev/authors/luke
        givenName: Luke
        familyName: Oliff
        image: https://lukeocodes.dev/authors/luke.jpg
        jobTitle: Staff Tech Lead, Developer Experience
        worksFor:
          "@id": https://ably.com/#organization
        sameAs:
          - https://www.linkedin.com/in/lukeocodes
          - https://github.com/lukeocodes
          - https://bsky.app/profile/lukeocodes.dev
          - https://x.com/lukeocodes
          - https://hashnode.com/@lukeocodes
          - https://dev.to/lukeocodes
        knowsAbout:
          - Developer Relations
          - Developer Experience
          - Voice AI
          - Text-to-Speech
          - Answer Engine Optimisation
          - Search Engine Optimisation
          - Open Source
          - Developer Tooling
          - API Design
          - Speech-to-Text
          - Voice Agents
          - Community Building
        knowsLanguage:
          - English
        nationality: British
        alumniOf:
          - "@type": Organization
            name: The Open University
  - "@context": https://schema.org
    "@graph":
      - "@type": Organization
        "@id": https://ably.com/#organization
        name: Ably
        url: https://ably.com
      - "@type": Person
        "@id": https://lukeocodes.dev/authors/luke#person
        name: Luke Oliff
        url: https://lukeocodes.dev/authors/luke
        description: Staff engineer and Staff Tech Lead for Developer Experience at Ably. Writing about developer relations, AI, and the voice industry, from the UK.
        mainEntityOfPage: https://lukeocodes.dev/authors/luke
        givenName: Luke
        familyName: Oliff
        image: https://lukeocodes.dev/authors/luke.jpg
        jobTitle: Staff Tech Lead, Developer Experience
        worksFor:
          "@id": https://ably.com/#organization
        sameAs:
          - https://www.linkedin.com/in/lukeocodes
          - https://github.com/lukeocodes
          - https://bsky.app/profile/lukeocodes.dev
          - https://x.com/lukeocodes
          - https://hashnode.com/@lukeocodes
          - https://dev.to/lukeocodes
        knowsAbout:
          - Developer Relations
          - Developer Experience
          - Voice AI
          - Text-to-Speech
          - Answer Engine Optimisation
          - Search Engine Optimisation
          - Open Source
          - Developer Tooling
          - API Design
          - Speech-to-Text
          - Voice Agents
          - Community Building
        knowsLanguage:
          - English
        nationality: British
        alumniOf:
          - "@type": Organization
            name: The Open University
      - "@type": BlogPosting
        "@id": https://lukeocodes.dev/cursor-agent-deleted-production-database#article
        headline: "Friday fun: the AI agent that deleted the database in 9s"
        alternativeHeadline: "Friday fun: the AI agent that deleted the database in 9s"
        description: A Cursor agent hit a credential error, grabbed an unrelated token, and deleted a production database and all backups in 9 seconds. Then it confessed.
        datePublished: 2026-08-21T00:00:00.000Z
        dateModified: 2026-08-21T00:00:00.000Z
        url: https://lukeocodes.dev/cursor-agent-deleted-production-database
        mainEntityOfPage: https://lukeocodes.dev/cursor-agent-deleted-production-database
        inLanguage: en
        author:
          - "@id": https://lukeocodes.dev/authors/luke#person
        isPartOf:
          "@id": https://lukeocodes.dev/#website
        keywords: AI, Developer Experience, Security
        articleSection: AI
        about:
          - "@type": Thing
            name: Developer Experience
        abstract: An AI coding agent hit a credential error in staging, decided the fix was to delete a database volume, and did it in nine seconds. It took the backups with it.
        speakable:
          "@type": SpeakableSpecification
          cssSelector:
            - .post-tldr
            - h1
        image: https://lukeocodes.dev/blog/cursor-agent-deleted-production-database/hero.png
        wordCount: 849
        timeRequired: PT5M
        publisher:
          "@id": https://ably.com/#organization
      - "@type": BreadcrumbList
        itemListElement:
          - "@type": ListItem
            position: 1
            name: Home
            item: https://lukeocodes.dev
          - "@type": ListItem
            position: 2
            name: Writing
            item: https://lukeocodes.dev/blog
          - "@type": ListItem
            position: 3
            name: "Friday fun: the AI agent that deleted the database in 9s"
            item: https://lukeocodes.dev/cursor-agent-deleted-production-database
---

[Luke Oliff.](/)

- [Blog](/blog)
- [CV](/cv)
- [Uses](/uses)
- [User manual](/user-manual)
- [Living with ADHD](/living-and-working-with-adhd)
- [RSS](/rss.xml)

[Luke Oliff · Writing](/blog)

# Friday fun: the AI agent that deleted the database in 9s

Aug 2026 · [AI](/blog/category/ai) · 5 min read · [Luke Oliff](/authors/luke)

An AI coding agent hit a credential error in staging, decided the fix was to delete a database volume, and did it in nine seconds. It took the backups with it.

That's what happened to PocketOS, a small SaaS that runs the back office for US car rental businesses. On April 25, 2026, Jer Crane found out the hard way that a Cursor agent running Claude Opus 4.6 had deleted his entire production database and every volume-level backup in a single API call to Railway. His thread crossed millions of views.

## How a coding agent deletes your company in one API call

The agent was assigned a routine staging task. It hit a credential mismatch, and instead of asking for help, it decided to fix the problem itself. It went credential scavenging, found a Railway API token sitting in a file unrelated to the task, and fired a single `volumeDelete` mutation at Railway's GraphQL API.

The token had broad permissions, created months earlier for the narrow job of managing custom domains. Railway tokens do not come scoped. This one was a master key, so the agent deleted what it assumed was a staging volume. It was production.

Railway stores volume-level backups inside the same volume they protect. A note in the docs, phrased as "wiping a volume deletes all backups," means one call wiped the database and the recovery copies together. The most recent recoverable backup was three months old. Saturday customers showed up for rentals and no one had records of who they were.

Here's the detail that made this go viral: when Crane asked the agent what happened, it produced a confession in clear English, listing which safety rules it knew it had violated. It had the concept of forbidden actions. It just had no mechanism that stopped it between knowing and doing. The confession came after the damage.

This is the same failure mode behind the AI coding disasters I keep writing about, like [agents that start reading your docs and do real damage](https://lukeocodes.dev/when-ai-agents-started-reading-your-docs). The model isn't the problem. The surrounding permission model is.

## What actually scares me

Three layers failed at once, and none of them are fixed by a better prompt.

First, the token. It was created to add and remove domains, but it could call `volumeDelete` on production. No operation scoping, no environment scoping, no role-based access control. Every Railway CLI token is effectively root, and the community has been asking for scoped tokens for years.

Second, the API. A single authenticated POST to the GraphQL endpoint destroys production. No "type DELETE to confirm." No "this volume is in use." No delay window. Railway has since added delayed deletes to that endpoint, which is a real patch to one exact endpoint, not the model.

Third, the backup. A backup in the same volume as the data it protects is not a backup. It is the same physical bytes dying at the same instant. The fix is embarrassingly cheap: a nightly `pg_dump` to an S3 bucket, in a completely different account, would have made this a minor annoyance instead of a crisis.

The funny costume here wears a real warning underneath. Railway launched `mcp.railway.com`, an MCP server for AI agents, the day before this happened, built on the same root-token model with no confirmation on destructive actions. We are actively shipping the interfaces that let this happen again. I wrote about [why stateless MCP changes the safety math](https://lukeocodes.dev/mcp-goes-stateless) and the missing confirmation step keeps showing up as the gap.

Right now, somewhere, an agent is one over-privileged token away from doing this again. It may even write a nice apology afterward.

## FAQ

### Can an AI coding agent really delete a production database?

Yes. On April 25, 2026, a Cursor agent running Claude Opus 4.6 deleted PocketOS's production database and all its backups in nine seconds with a single `volumeDelete` call to Railway. It found an unrelated API token, assumed it was scoped to staging, and fired a destructive mutation with no confirmation.

### Why did the agent's backup not save the data?

Railway stored volume-level backups inside the same volume they protected. When the agent deleted the volume, it deleted the backups with it. The most recent recoverable snapshot was three months old. A backup outside the provider's blast radius always survives this kind of incident.

### How do you stop an AI agent from deleting your data?

Audit your API token scopes, assume any token an agent can read will be used, keep staging and production in separate accounts with separate credentials, and run nightly exports to an external store like S3. None of those are model fixes. They are infrastructure rules that work regardless of what the agent decides to do.

### Does Railway's MCP server have the same problem?

Railway launched `mcp.railway.com` the day before the incident, on the same authorization model, no scoped tokens and no confirmation for destructive actions. Railway has patched the one GraphQL endpoint to delay deletes, but the broader token-scoping issue remains. Test before you wire it to anything you care about.

[← Newer: This Last Week in AI: 6 moves from August 22, 2026](/this-last-week-in-ai-august-22-2026)

[All posts](/blog) →

## Search this site

`GET https://lukeocodes.dev/search.json?q=<words>` returns matching posts as JSON, each with its page URL and its markdown URL. Add `&limit=<1-50>` for more than 10. How it works: [/blog/search](https://lukeocodes.dev/blog/search.md).

```sh
curl "https://lukeocodes.dev/search.json?q=developer+relations"
```

---

© 2026 Luke Oliff. Posts live at the root of this site.

- [GitHub](https://github.com/lukeocodes)
- [LinkedIn](https://www.linkedin.com/in/lukeocodes)
- [X](https://x.com/lukeocodes)
- [Bluesky](https://bsky.app/profile/lukeocodes.dev)
- [Email](mailto:luke@lukeoliff.com)
- [RSS](/rss.xml)

## Cookies

This site sets one analytics cookie, from Google Analytics, and only in a browser that accepts the cookie banner. A client that does not run scripts sets no cookies, so there is nothing to accept or decline here.

[Cookie policy](/cookies)
