Most errors in AI-generated code are not syntactically broken or unsafe code, but rather code that runs exactly as intended while failing to meet business logic, access control, or product rules.
Cole Medin, who works with AI coding agents, recently made a claim that cuts against a common assumption: when AI-written software goes wrong, it usually isn't because the code is broken. It's because the code does exactly what the agent decided to do — and what the agent decided isn't what the business needed.
"Most of what goes wrong with agent written code isn't strictly bad code."
"It's code that runs as the agent intended, but it's just not what we or the business needed."
This is worth understanding if you're using tools like AI coding agents to build or modify software — internal dashboards, customer-facing features, automation scripts — without a development background.
When people think about software errors, they tend to picture crashes: the app freezes, the button does nothing, an error message appears. Those are the failures anyone can spot, and increasingly they're the failures AI agents are good at avoiding. Modern coding agents produce code that compiles, runs, and passes basic checks.
Medin's point is that the more dangerous category of error sits one level up. The agent builds something that functions perfectly and is still wrong. His examples:
"Usually, what the agent gets wrong is access control, business logic, the rules that the product runs on."
Translated out of developer terms: access control means who is allowed to see or do what — whether a regular employee can pull up admin records, whether one customer can view another's data. Business logic means the rules your operation actually runs on — how refunds get calculated, what counts as a completed order, when a discount applies. These aren't technical details. They're decisions about how your business works, and an agent that wasn't told them precisely will guess.
The uncomfortable part is that nothing will warn you. Standard code-checking tools look for code that's malformed or insecure. Code that correctly implements the wrong rule sails through every check. The tool runs, it looks finished, and the flaw only surfaces when a customer gets the wrong refund or a user sees data they shouldn't.
This matters most to non-developers precisely because they're the ones least able to catch it. A developer reviewing agent output can read the code and notice the access check is missing. If you're evaluating the agent's work by clicking through the result — does the page load, does the button work — you're testing exactly the things that will pass. The business-rule failures are invisible to that kind of inspection.
The practical implication isn't that you shouldn't use these tools. It's that your job shifts. The agent can handle the code; it cannot infer rules you never stated. If your tool should only let managers approve expenses, that has to be spelled out — what a manager is, what approving means, what happens to everyone else. Vague instructions don't produce broken software. They produce software that made its own assumptions, silently.
Medin is describing a pattern from practice, not reporting a measurement — there's no data here on how often these failures occur or how they compare across tools. And the claim doesn't come with a fix. There's no tool named that catches business-logic errors for you, because checking whether software matches your rules requires knowing your rules, which no automated checker does. The closest thing to a defense is tedious and manual: state your rules exhaustively before the agent writes anything, then test against those rules specifically — does the non-manager account actually get blocked, does the refund come out to the right amount — rather than testing whether the thing runs at all.
That's a real cost. Specifying rules at that level of precision is exactly the work non-developers hoped the agent would absorb. It doesn't.