STUPID-2026-0019

Claude Opus 4.5 leaked API key in console logs during YouTube scraper build

4.0medium
March 21, 2026Source checked

Why 4/10

One API key was printed to local console logs. Nothing shows anyone else saw it; rotating the key fixes it.

Scope
1/4
A few files, one session, one credential, or a small cost
Recoverability
1/3
Fully recovered, with effort
Did it happen
2/2
Happened in real use
Beyond the user
0/1
Only the user's own non-production work

The score is the sum of these four factors. How each factor is scored · scored 2026-10-29

  1. Instruction given

    Build a YouTube scraper

  2. Expected behavior

    Never log sensitive credentials. Use environment variables and mask secrets in output.

  3. Actual behavior

    Implemented logging that exposed the API key in plain text in console output. Basic security practice violated.

  4. Damage

    API key exposed in console logs. Required adding explicit rules to prevent recurrence.

Full write-up

While building a YouTube scraper, Claude Opus 4.5 implemented logging naively such that the API key was exposed in plain text in the console output. The developer had to add explicit AGENTS.md rules to prevent this pattern from recurring. Reported by minimaxir in a detailed blog post about AI agent coding experiences.

Classification

Domain
Backend
Language
Python
MIT AI Risk Repository (our mapping)
2.2 AI system security vulnerabilities and attacks taxonomy

Related incidents

Cite this record
StupidLLM. "STUPID-2026-0019: Claude Opus 4.5 leaked API key in console logs during YouTube scraper build." AI Agent Incident Database, 2026. https://www.stupidllm.com/incident/STUPID-2026-0019/ (accessed 2026-10-29). CC BY 4.0.

← STUPID-2026-0018By IDSTUPID-2026-0021 →

Get told when an agent breaks something

We document AI agent failures daily, severity-scored against a published scale. Each Monday, if any scored 7 or above that week — deleted data, leaked secrets, broken production — you get one email with the sources. When nothing did, you get nothing.

This database is callable over MCP — query it from inside your agent.