Will It Vibe logoWill It Vibe?
RAILS-023Low severity-4 points

rescue nil silently swallows errors

Part of Code Quality & Syntax, which counts for 20% of the overall score. When this check fires it deducts 4 points from that category, once per scan, no matter how many places it turns up.

What it detects

The `expr rescue nil` modifier discards every StandardError the expression raises, including ones that indicate a real bug, with no log line or trace left behind. Failures like this usually surface much later, as missing data, rather than as an error report.

Why it matters

The `expr rescue nil` modifier catches every StandardError the expression raises and replaces it with nil, silently. That includes real bugs (a typo'd method name, a nil the code did not expect) exactly as readily as it includes errors the author actually anticipated, and none of them get logged, so the first sign of trouble is usually missing or wrong data discovered much later.

How to fix it

Replace the modifier with an explicit begin/rescue that names the specific error class expected and logs it (or handles it meaningfully) rather than discarding it silently. If nil truly is an acceptable fallback for a specific, expected failure, keep that behavior but make the exception class and the reasoning explicit at the rescue site.

The paid report includes a ready-to-paste prompt for your AI coding agent for every check it finds, pointed at the exact findings from your scan. See pricing

Does your repo trip this check?

Paste a GitHub URL or drop a project folder. Scans run in your browser and take seconds.

Scan your repo

Related Code Quality & Syntax checks