rusackas opened a new pull request, #42738: URL: https://github.com/apache/superset/pull/42738
### SUMMARY `GlobalErrorHandlerMiddleware._handle_error` in `superset/mcp_service/middleware.py` only checks `isinstance(error, ValidationError)` against **pydantic's** `ValidationError`. FastMCP 3.x raises its own `fastmcp.exceptions.ValidationError` for malformed tool arguments, which is a sibling type (not a subclass of pydantic's, and not a subclass of `ToolError`), so it falls through to the generic branch and gets reported to the client as `"Internal error in <tool>: An unexpected error occurred... contact support"` instead of the existing, self-correcting `"Validation error in <tool>: ..."` message. This is a test-only PR pinning the reported behavior — it does not attempt the fix. It's currently **red**, confirming the bug reproduces on `master`. Note: [PR #41921](https://github.com/apache/superset/pull/41921) is open and touches this same file extensively (adds metrics/error-hook instrumentation), and a bot comment on the issue claims it fixes this. I checked the diff directly — it does not touch the `isinstance(error, ValidationError)` dispatch line at all, so this bug is still live independent of that PR. ### TESTING INSTRUCTIONS ``` .venv/bin/python -m pytest tests/unit_tests/mcp_service/test_middleware.py::TestGlobalErrorHandlerLogLevels -q ``` The new `test_fastmcp_validation_error_routes_to_validation_branch` fails today with: ``` AssertionError: Regex pattern did not match. Regex: 'Validation error in execute_sql' Input: 'Internal error in execute_sql: An unexpected error occurred. Error ID: err_....' ``` All 11 other tests in the class, and all 86 tests in the file, still pass. ### ADDITIONAL INFORMATION - [x] Has associated issue: #42578 - [ ] Required feature flags: - [ ] Changes UI - [ ] Includes DB Migration - [ ] Introduces new feature or API - [ ] Removes existing feature or API -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
