EspiritoEspirito Logo

Avoiding an AI Coding Disaster: What can go wrong and how to combat risk

How to Avoid an AI Coding Disaster

For many developers, AI-assisted software development has increased their productivity. But there is a balance to strike, as using tools like AI coding agents can quickly decent into unmanageable risk and recurring disasters. Just like with any tools, knowing how to use it effectively is key, which is why we’ve written about how to use AI effectively and responsibly in the past. But here, we focus on the ways AI-powered coding tools can go wrong, and what you can do to avoid disaster.

Why AI Differs to Humans

Generative AI models are built upon neural networks, which are designed to mimic how the human brain works. While this has proved effective to bring various artificial intelligence implementations forward, it doesn’t mean they ‘think’ like humans do.

In reality, Generative AI models can be boiled down to prediction. In 2026, models can often access other skills like writing and executing code, searching the internet, etc., but prediction is the core mechanism they use to do work. This results in a machine that is really good at mimicking human outputs, but cannot replace the human thought process.

This means AI work must be treated differently to human work. You need to put mechanisms in place to ensure AI doesn’t make the mistakes it would otherwise be susceptible to.

Let’s take a look at some of those mechanisms and how they can help you avoid an AI coding disaster.

Avoiding an AI Coding Disaster

1. Don’t let AI access Mission-Critical Infrastructure

While current AI models aren’t malicious, that doesn’t mean they’ll never do wrong. In fact, they’ll sometimes confidently cause havoc. (Photo: lrunups / Shutterstock)

AI has a semi-occasional, but devastating tendency to confidently get things completely wrong. So it’s one thing for it to suggest DROP DATABASE prod, but a whole other for it to do it itself. Keep AI away from your env file, production environment, or anything else that would cause an immediate or catastrophic failure for active users.

It’s no accident that, as developers, we rarely have access to live systems: when your code doesn’t work yet, you want it as far away from production as possible. Likewise, everything AI does should be in a sandboxed environment, with a database that doesn’t matter connected to sandboxed services that won’t cause havoc if purged.

2. Balance Additive AI and Replacement AI

The integration of AI into your workflow can be broadly split into two categories: adding or replacing. Both can be beneficial, but knowing when to use either is crucial

  • Additive AI is safest, but most limited. This might be an extra pair of eyes on your code, helping you manage your time better or suggest resolutions for a bug you’re working on.
  • Replacement AI is more capable, but more risky. Taking the above examples, a replacement version might write the code for you, tell you what to work on or fix the bugs itself without getting you involved.

A common sentiment about AI coding is that it can — and should — replace the ‘busy work’, but only augment complex tasks to make human coders more efficient. Stack Overflow reports that developers are becoming increasingly frustrated with AI-generated code that is ‘almost right’, with more complex use-cases still having devs turn to other humans for assistance. This alone highlights a fundamental truth with current-day AI: it cannot replace human developers, but it can let them spend time on the things that matter most.

3. Use AI for Review, but Don’t Inherently Trust It

A great use of AI is to have an extra set of eyes on your code, but don’t let it be the only one looking. (Photo: Phonlamai Photo / Shutterstock)

Tools like CodeRabbit act as AI reviewers for your code, spotting bugs, security vulnerabilities and other issues in your code. These can be a great addition to your CI/CD workflow as it can reduce the amount of time human reviewers need to spend looking at buggy code.

However, relying on these tools can quickly lead to an AI coding disaster. For example, AI reviews do not:

  • Replace code testing with tools like Pest, Jest or Playwright.
  • Make user acceptance testing (UAT) redundant.
  • Mean you can write code haphazardly and rely on AI correct it.
  • Supersede the human review process.

Think of AI review tools as an additive tool rather than replacing an existing step with a faster version. A human checking over both AI review suggestions and the code remains a crucial step to retain quality and dependability. Speaking of which ...

4. Always Audit Outputs

A concerning trend when using AI-assisted development is complacency, or the ‘vibe coding trap’. Because when AI can write your code, expand your test suite and test it itself, why would you need to review the code yourself.

The reason is quality.

There is a big gap between code that works and high quality code, and with AI, you’re never quite sure which you’re going to get. For boilerplate code that’s been written millions of times, AI will likely generate the correct code, but for nuanced or complex scenarios, its outputs risk looking correct while containing subtle inaccuracies can quickly lead to an AI coding disaster.

‘Correctness’ should not only be measured by the end result, but also how you get there. And this means you should always audit AI-authored changes to ensure it fits with your and your business’s quality standards. Production-level code should not be of prototype quality, and the human approval process remains one of the most effective ways to find those types of issues.

5. Retain Human-Written Code

Human-written code is still crucial in the AI age. (Photo by Fatemeh Rezvani on Unsplash)

AI — fundamentally — learns from existing material. There have been multiple studies which found that AI models collapse once they are trained more on AI generated output. This highlights the continued need for human contributions otherwise the AI will not be able to safely grow into the future.

So be deliberate about where you use AI.

Need to make simple, batch changes? Go ahead.

Setup some boilerplate code for you? Easily done.

But nuanced changes that need thought, care and expertise? Leave that to the humans. But that doesn’t mean leave it completely to humans; AI can still help, but the solution should be human-driven.

Conclusion

As has been the case for the past few years, the future of AI is uncertain. We have yet to experience a technology which moves so quickly, so predicting its future isn’t easy. But for now, AI has fundamental limitations that makes operating it haphazardly a recipe for disaster. In 2026, AI coding is a mix of machine and human work, which means your own knowledge and experience is critical to success.

Post Details

Author: Lachlan Rehder

Categories:

Updated: 24 Apr 2026

Interested in one of our products?

Get in touch and let us know how we can help! 😇