Services

Our findings

Discover expert insights and industry trends to fuel innovation. Stay updated with the latest strategies and success stories.

Banner
AI
Technology
Consultation

The AI Wrote the Bug, Then Blamed Me

By Adil Gulzar · Sep 16, 2026 · 6 min read

The AI Wrote the Bug, Then Blamed Me

Today I was working on a project that was completely vibe-coded. Not one line was written by me or by any other developer. Every file, every function, every commit came from a single AI coding agent: Claude Code. That raises a question every business shipping AI-generated code now has to answer: who actually verifies it?

Then a critical bug showed up. The kind of bug that makes you stop and stare at the screen. So I asked the agent a simple question: how could anyone in their right mind write this code?

The answer was honest, and a little funny. It agreed with me completely. This code was wrong.

The Investigation

Curious, I asked it to dig deeper. Was there a reason behind this? Who wrote it, and why?

It went through the git history and came back with a confident verdict: the commit was under my name. So, according to the evidence, I was the one who wrote that code.

I told it that the only developer who has ever worked on this project is you. It didn't accept that. The git log said otherwise.

And I sat there, genuinely amused. Because I have seen this exact scene many times before, with humans.

The Oldest Ritual in Software Teams

I've been building for the web since 2008, and in every dev team I've worked with, the blunder always belongs to someone else. Production breaks. Everyone opens the file. Everyone agrees the code is terrible. And then, slowly, every finger points somewhere else: the developer who left last year, the freelancer, the "quick fix" from another team.

Nobody wrote the bad code. It just appeared.

I didn't expect to see that ritual reproduced by a coding agent. But here we are.

Human dev team Bug in production "Who wrote this?" "The dev who left last year" Nobody owns the fix AI coding agent Bug in production "This code is clearly wrong" "git blame says you did it" Nobody owns the fix Different team member, identical ending
The blame game survives the move from human teams to AI agents.

Why the AI Coding Agent Actually "Blamed" Me

To be fair to the machine, it wasn't lying. It was doing exactly what a new developer on the team would do: trusting the evidence in front of it.

Here is what really happens in an agent-driven project:

  • The agent writes code and commits it using your git identity, because it runs on your machine with your config.
  • Each new session starts with little or no memory of what previous sessions did.
  • So when it runs git blame, it sees your name, and it has no way to recognise its own past work.
Agent writesthe code Commits underyour git name Session ends,memory gone git blamepoints at you The code has no real author, only a name on a commit
Where authorship gets lost in an AI-built project.

In other words, the authorship trail is broken by design. That is a funny story. It is also a serious problem.

So Who Verifies AI-Generated Code?

This is the real question, and it matters for every business now shipping vibe-coded products.

If an AI writes the code, the same AI reviews the code, and the same AI investigates the bug, then nobody has actually verified anything. You have one system grading its own homework, and forgetting it did the homework in the first place.

The agent was quick to agree the code was wrong once I pointed at it. It did not catch the problem when it wrote it. That gap, between writing code and knowing what good code looks like, is exactly where experience lives.

Verification needs someone who:

  • Can read the code and understand why it is wrong, not just that a test failed.
  • Knows the business context the AI never had.
  • Takes responsibility when it breaks, instead of pointing at git blame.

That person is not optional. AI has made writing code cheap. It has not made judgement cheap.

Leave Notes for Your Memento Developer

A coding agent is like the man in Memento: brilliant, fast, and unable to remember yesterday. Without notes, he investigates his own crime and concludes someone else did it. That is exactly what happened to me.

So the first half of the fix is simple: every piece of AI-written code must be traceable, and its reasoning must be written down.

  • Mark AI authorship in git. Use co-author trailers or a clear commit convention, so history tells the truth about who (or what) wrote each change. git blame should never point at a human for code a human never touched.
  • Document the why, not just the what. Ask the agent to record why it chose this approach, what alternatives it rejected and what assumptions it made, in the commit message, the pull request or a decision log. Code shows what was done. Only the reasoning shows what it was thinking.
  • Keep a project memory file. Architecture decisions, business rules and known pitfalls live in the repo, and every new agent session reads it first. Every session is the agent's first day on the job, so give it an onboarding document.

Now when a bug appears, you can open the notes and say: you wrote this, on this date, for this reason. And you can see exactly where the reasoning went wrong.

But Notes Are Not Verification

Here is the trap. If the AI writes the code and writes the explanation, the explanation can be just as wrong as the code. An AI can produce a confident, well-formatted justification for a bad decision. Documentation only records what the AI believed. It does not tell you whether it was right.

That is the second half of the fix, and it is the part no tool replaces:

  • Human review on critical paths. Payments, authentication, data handling and anything customer-facing get read by an experienced engineer before merge, with the AI's reasoning right next to the code.
  • Tests written from requirements, not from the code. If the AI writes both the code and the tests from the same misunderstanding, both will pass together.
  • One accountable owner. Not "the AI". A person.

If you're planning how AI fits into your development process, this is exactly the kind of setup we work through in our AI consultation sessions.

The Blame Game Doesn't Change. Accountability Has To.

I will keep using coding agents. They are incredibly productive, and I've written about why real engineers shouldn't be loyal to any single model in Real AI Engineers Aren't Married to One Model.

But this small moment taught me something. Whether the developer is a person or an agent, the code will eventually break, and someone will look for someone else to blame.

AI will keep writing more of our code, and it will keep forgetting that it did. So leave it notes: traceable commits, documented reasoning, a project memory it reads every session. But notes only tell you what the AI thought. Someone who has been doing this for years still has to decide whether it was right.

Built with AI? Get it verified by someone who's been shipping code since 2008.

If your product was vibe-coded and you are not sure what is hiding inside, we can review it before your customers find out.

Get your first week of code review free

Prefer to talk first? Book a free consultation →

AG

Written by Adil Gulzar

Adil has been building for the web since 2008, before most of the frameworks developers argue about today existed. As a CTO and solution architect, he has worked with 100+ entrepreneurs and shipped 50+ large-scale products, most of them long before AI made building look easy. Today he leads Mango Coders, where companies bring him in for the decisions they cannot afford to get wrong. He writes here between projects. His consultation calendar is deliberately small, so if you can get a slot, take it.

Building your product with AI agents? Get your first week of code review free →

Related Blogs

SEO
Technology
Design

What is open source?

12 / 01 / 2024

Open source is a term derived from OSS which is defined as open-source software. Open-source software or you can say its code is publicly accessible

Explore more
MongoDB lifts the development to the door of Magic
Technology

MongoDB launched in 2007 and became popular within a few years. Let’s discuss how MongoDB changed modern development practices.

Explore more
Which one is better among Shopify and WordPress?
Technology

When you think of an online business you will come across the word SEO and most businesses are aware that SEO is necessary for success.

Explore more
Learn UI/UX
Technology
Design

Learn UI/UX

05 / 15 / 2024

Why is it now the time to learn UI & UX? User Interface (UI) is anything a user may interact with, and User Experience (UX) ensures it is smooth.

Explore more
Real AI Engineers Aren't Married to One Model
AI
Technology
Consultation

After 18 years watching developers fight over languages, frameworks, and now AI models, here is why fundamentals, not vendor loyalty, make a real AI engineer.

Explore more
Why You Still Need a CTO or Solution Architect in the AI Era
AI
Technology
Consultation

AI writes code fast and makes expensive mistakes silently. A real story from our own automation on why every serious product still needs a CTO-level architect.

Explore more
How to Interview Developers in the Post AI Era
Hiring
AI
Consultation

Leetcode is dead. Here is the interview I run after 1000+ hires: the tests that show whether a developer has real judgment or just AI access.

Explore more
Company Logo

We provide a wide range of services to fill the voids in your organization or product. We provide you with an online identity to increase your business.

Services

Office

345, Block H-3 Johar Town, Lahore

+92-306-4500050
upwork
Freelance

© 2026 MangoCoders. All rights reserved.