Hallucinated APIs and plausible-but-wrong logic.
When reviewing code generated by an LLM, you are not looking for syntax errors (it rarely makes them). Instead, you are hunting for AI Failure Modes.
These include Hallucinations (using functions that don't exist in the library), Off-by-one errors (failing at boundary conditions), and Silent Failures (swallowing exceptions to make the code look cleaner). You must read the code with a magnifying glass.
# 1. Hallucinated APIs
# AI models predict the "most likely" next token. If a library
# SHOULD have a 'list_all' method, the AI will invent it.
# You must verify against the actual docs (it's actually list_objects_v2).
# 2. Plausible but wrong schema
# The AI assumed S3 objects have an 'Age' property. They don't.
# They have a 'LastModified' datetime. This code crashes immediately.
# 3. Swallow-all Exceptions
# AI loves to write "except Exception: pass". This silently hides
# permission errors, network timeouts, and actual bugs. Never allow it.