Skip to content

[Bugfix] Preserve original ImportError in gRPC server entrypoint#38673

Open
CatherineSue wants to merge 1 commit intovllm-project:mainfrom
CatherineSue:changsu/fix-grpc-import-error
Open

[Bugfix] Preserve original ImportError in gRPC server entrypoint#38673
CatherineSue wants to merge 1 commit intovllm-project:mainfrom
CatherineSue:changsu/fix-grpc-import-error

Conversation

@CatherineSue
Copy link
Copy Markdown
Contributor

Purpose

Fix misleading error message when smg-grpc-servicer is installed but has a broken internal import (e.g. version mismatch between servicer and vllm, or a missing transitive dependency like grpcio).

Currently from None suppresses the original traceback, so the user only sees:

ImportError: smg-grpc-servicer is required for gRPC mode.
Install it with: pip install vllm[grpc]

This is misleading when the package IS installed but an internal import fails — the real error is hidden.

Test Plan

Manual verification: introduce a broken import inside smg_grpc_servicer and confirm the chained traceback is now visible.

Test Result

After this change, the original ImportError is chained and visible:

ImportError: <real error details>

The above exception was the direct cause of the following exception:

ImportError: gRPC mode requires smg-grpc-servicer.
If not installed, run: pip install vllm[grpc].
If already installed, there may be a broken import due to a
version mismatch — see the chained exception above for details.

  • The purpose of the PR: preserve original traceback for gRPC import errors
  • The test plan: manual verification of error output
  • The test results: chained exception now visible

Change `from None` to `from e` so the original traceback is visible
when smg-grpc-servicer is installed but has a broken import (e.g.
version mismatch, moved function). Previously the real error was
swallowed and replaced with a generic "install the package" message.

Signed-off-by: Chang Su <chang.s.su@oracle.com>
@CatherineSue CatherineSue requested a review from njhill as a code owner April 1, 2026 01:10
@mergify mergify bot added frontend bug Something isn't working labels Apr 1, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request improves the error handling for gRPC-related imports in vllm/entrypoints/grpc_server.py. The updated logic now captures the original ImportError and provides a more descriptive error message to help users diagnose potential version mismatches or installation issues. I have no feedback to provide as there are no review comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working frontend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant