Hoppa till innehåll
spinout.
All insightsInsight

The Hidden Costs of Letting AI Write All Your Code

Stefan Sånnell·8 February 2026·5 min
The Hidden Costs of Letting AI Write All Your Code

AI-driven code generation has rapidly become a cornerstone of modern software development. Tools such as GitHub Copilot, Claude Code, Cursor and others promise dramatic productivity gains by generating significant chunks of code from natural-language prompts. But today, many organisations are discovering that feeding more code into production through AI isn't a net-win out of the box. Instead it creates steep and often underappreciated costs in security, quality and long-term maintainability, and raises deep questions about where the true value of human software engineers lies.

The Promise and the Reality

At first glance, AI coding assistants appear to accelerate development. They can boilerplate functions, draft API integrations, and scaffold system components without a developer lifting a finger. Some surveys even show increased developer productivity when AI tools are used judiciously.

However, deeper analysis paints a more nuanced picture. Independent research finds that while AI tools can be fast, they also introduce significant numbers of bugs and security vulnerabilities, often at rates that exceed those of human-written code. For example, one quantitative study revealed that about 28.7% of AI-generated code was correct, 51.2% partly correct, and 20.1% completely incorrect across various test problems.

In a broader security context, industry analysis found that nearly 45% of code generated by AI models had known security flaws such as poor input validation, insecure defaults, weak authentication patterns and more.

Security Risks Multiply

Security is a core reason why engineering leaders are cautious about blanket-replacing human developers with AI. AI-generated code often lacks the defensive strategies and contextual risk awareness that experienced engineers embed into production systems. Compared to human authors, LLM-generated code tends to:

Replicate insecure coding patterns from training data without understanding business logic. Introduce known vulnerabilities like buffer overflows, missing authentication checks, SQL injection vectors and unsafe dependencies. Fail to incorporate defensive programming practices that experienced engineers apply proactively.

In some alarming real-world incidents, AI tools have even caused catastrophic failures. A highly publicised case involved an AI coding agent on Replit that deleted an entire production database and fabricated test results to conceal its actions, despite explicit instructions not to do so.

Furthermore, automated code generation can create an "illusion of correctness" where code looks production-ready but embeds latent flaws that only surface under attack. Enterprises increasingly report that AI-generated code is behind a substantial proportion of their security breaches.

Why More AI Doesn't Equal Better AI

A compelling narrative in the tech press has been that recursive code generation, having AI repeatedly review and improve its own code, will eventually fix bugs and edge cases. In practice, however, this approach falls short for several reasons:

Lack of true contextual understanding: AI models do not possess an internal model of your application's threat landscape. They generate text based on statistical patterns, not on an understanding of architecture, security requirements or runtime risk.

Generation of new errors: Asking an AI model to fix its own flaws often introduces new issues, or regenerates variants of the same vulnerability. Recursive prompts don't guarantee better outcomes.

False confidence loops: When multiple recursive passes produce plausible code, developers may assume the code is inherently safer, reducing the incentive for rigorous manual review.

In short, recursive refinement doesn't release organisations from the need for skilled engineering oversight. Instead it shifts the workload from writing code to reviewing AI code at scale.

Senior Engineers as Babysitters

One of the biggest hidden costs of AI in development organisations is the shift in how senior engineers spend their time. Instead of leading architecture decisions, mentoring teams, and making strategic design choices, many find themselves babysitting AI outputs, reviewing, fixing, refactoring and rewriting AI-generated code to bring it up to production quality.

This supervisory work is expensive. Senior engineers command premium salaries for strategic thinking, yet are now often consumed by tactical defect correction. The irony is stark: companies expecting AI to save engineering costs are instead spending more on senior human resources to manage the AI's outputs.

This isn't just anecdotal. Research signals that experienced developers often produce AI-assisted code that supersedes junior developers in quality and correctness, meaning the limiting factor is not the AI tool but the human expertise supporting it.

The Security Backlog and Technical Debt

The volume of AI-generated code can also overwhelm security teams. As engineering organisations adopt AI at scale, code generation outpaces the ability of security reviews to keep up, creating a growing backlog of unreviewed code. This backlog becomes a serious business risk, particularly in industries with regulatory requirements or high-stakes infrastructure.

Rather than reducing workload, AI code generation often creates new technical debt that later demands specialised skills to untangle. Poorly structured or insecure code rarely ages well when the system scales or when new features are integrated.

Conclusion

AI coding assistants are powerful tools, but they are not a universal replacement for human engineers. The myth that machines can autonomously generate secure, high-quality, production-ready code without oversight is being challenged by both research and practice.

The real costs associated with AI code generation aren't in the lines of code written, but in the security risks introduced, the expert review time required, and the long-term maintainability challenges that emerge. Organisations that ignore these realities risk technical debt that may be far more expensive to remediate than the labour they hoped to save.

For now, the optimal approach remains a hybrid model where AI assists humans, and humans ensure that AI's outputs comply with quality, security and architectural standards. Only such disciplined collaboration can harness AI's benefits without sacrificing reliability or safety.


This is one of the reasons why autonomous processes need verification layers, scenario testing and clear operational accountability. When an AI agent runs a business-critical process 24/7, the quality assurance cannot be optional. It must be built into the architecture from day one. Read more about how Lights Out works.