Skip to content

Fix bare except blocks that silently swallow all errors#388

Open
hobostay wants to merge 1 commit into
microsoft:mainfrom
hobostay:fix/bare-except-silent-errors
Open

Fix bare except blocks that silently swallow all errors#388
hobostay wants to merge 1 commit into
microsoft:mainfrom
hobostay:fix/bare-except-silent-errors

Conversation

@hobostay
Copy link
Copy Markdown

@hobostay hobostay commented May 4, 2026

Summary

  • Replace except Exception: pass with except ValueError: pass in the vLLM plugin registration code
  • The broad Exception handler hides real bugs (TypeError, AttributeError, etc.) that indicate a genuine problem, not just "already registered"
  • The transformers registry raises ValueError when a config class is already registered, so catching ValueError is sufficient

Details

Affected file: vllm_plugin/__init__.py (lines 40-53)

If the registration fails for a reason other than "already registered" (e.g., wrong argument types, missing attributes), the error would be silently swallowed and the model would malfunction later with no indication of the root cause.

Test plan

  • Verify the vLLM plugin still loads correctly on first invocation
  • Verify the plugin still works when loaded multiple times (already-registered case)
  • Verify that genuine registration errors are now properly raised

🤖 Generated with Claude Code

Replace `except Exception: pass` with `except ValueError: pass` in
vLLM plugin registration. The broad Exception handler hides real
errors like TypeError or AttributeError that indicate a genuine bug
(e.g., wrong argument types), not just "already registered".

The transformers registry raises ValueError when a config class is
already registered, so catching ValueError is sufficient.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant