No `throw new Error("not implemented")` in production code
Why it matters
A throw new Error('not implemented') turns into an HTTP 500 the first time any caller hits that code path. Because AI generates these as scaffolding — calculateRefund, sendInvoice, getUserBalance — the thrown paths often sit directly on revenue-critical flows. Users encounter them during checkout, refund, or billing and abandon the transaction; the defect then masquerades as a generic 500 in observability and takes hours to trace back to the stub.
Severity rationale
Medium because the failure is loud but only triggers when the specific path executes, often on a less-travelled flow.
Remediation
Implement the function against real logic or remove it and adjust every caller. Do not leave scaffold throws behind; a // TODO next to a thrown error is still a 500 in production. Fix at src/lib/billing.ts:
export function calculateRefund(amount: number) {
const feePercent = 0.03
return amount * (1 - feePercent)
}
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the WIP-in-Production Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
Taxons
History
- 2026-04-18·v1.0.0·Initial import from ai-slop-half-finished·automated