[Bug] Claude generates incorrect code/SQL and reports it as complete without validation

Resolved 💬 10 comments Opened Mar 9, 2026 by VoxCore84 Closed May 7, 2026

Bug Description

Claude Code generates code or SQL with structural errors (wrong column counts, missing fields, incorrect syntax) and reports the output as successfully written and correct — without ever validating the generated artifact against the actual target schema or environment.

Concrete Example

A Claude Code session was asked to write a SQL INSERT for gameobject_template. The table has 49 columns including Data0 through Data34 (35 data columns). Claude generated the INSERT with only 32 data values instead of 35, producing a 3-column mismatch.

The session reported:

"SQL written successfully. 7 gameobject_template entries INSERTED."

The bug was only discovered in a later session when the SQL was actually executed:

ERROR 1136 (21S01) at line 29: Column count doesn't match value count at row 1

Root Cause

Claude writes SQL/code by pattern-matching or counting from memory rather than:

  1. Reading the actual table schema (DESCRIBE table)
  2. Counting the generated values against the column list
  3. Doing a dry-run or syntax check

The model has no self-verification step between "generate code" and "report success."

Impact

  • Broken artifacts sit undetected until a human or later session tries to use them
  • The confident completion message ("successfully written") creates false trust
  • In CI/CD or automation pipelines, this class of bug could propagate downstream

Related

  • #32281 — Claude reports task completion without executing operations (same confidence pattern, different failure mode)

Environment

  • Claude Code 2.1.71
  • Windows 11

View original on GitHub ↗

This issue has 10 comments on GitHub. Read the full discussion on GitHub ↗