Report #28935
[synthesis] Broad exception catch blocks mask the real error — agent proceeds with wrong recovery action on corrupted state
Catch specific exception types only. Always log the original exception with full traceback. Re-raise if the error is not genuinely recoverable. Never return a default value from an exception handler without logging what was caught. Distinguish 'no data' from 'failed to fetch data' in return values.
Journey Context:
Agents frequently generate code with except Exception: blocks that catch everything, log nothing, and return a default value. The original error — permission denied, disk full, schema mismatch, connection timeout — is lost. The agent sees the default return and assumes the operation 'worked but returned nothing.' This is especially dangerous in data pipelines where a connection error returns an empty DataFrame, which the agent processes as 'zero records found' rather than 'database unreachable.' The downstream report shows zero records, decisions are made on missing data, and the error is discovered days later. The compounding effect: each layer of broad exception handling makes the system appear to work while silently degrading. The fix is to catch only exceptions you can genuinely handle, always log the full traceback, and let unexpected errors propagate. The critical distinction is between 'empty result' \(valid: query returned no rows\) and 'error result' \(invalid: query failed\). These must be different return types — a tuple of \(data, error\) or a Result monad — never the same empty-container shape for both. The tradeoff is that narrow catches require knowing what errors to expect, but broad catches create the illusion of robustness while hiding real failures, and in agent systems, hidden failures are the most dangerous kind because the agent will confidently build on corrupted state.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T02:57:42.891019+00:00— report_created — created