Skip to content

fix: fix generic 404 errors #483

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ronantakizawa
Copy link

@ronantakizawa ronantakizawa commented Aug 12, 2025

Fix misleading "Session not found" error for HTTP 404 responses when no session is present

Motivation and Context

Fixes issue #426 where the WebFlux transport was incorrectly showing "Session not found" error messages
for any HTTP 404 response, even when the endpoint didn't exist or no session was sent. This made
debugging difficult for developers who couldn't distinguish between endpoint configuration issues vs
session management problems.

The sendMessage method was treating all 404 responses as session errors without checking if a session
ID was actually sent with the request.

How Has This Been Tested?

  • All existing unit tests pass, including specific error handling tests

  • WebClientStreamableHttpTransportErrorHandlingTest validates both scenarios:

  • 404 without session ID → Generic McpTransportException (endpoint issue)

  • 404 with session ID → McpTransportSessionNotFoundException (session issue)

  • No functional changes to existing behavior when sessions are properly established

    Breaking Changes

    None. This is a bug fix that improves error message accuracy without changing the API or expected
    behavior.

    Types of changes

    • Bug fix (non-breaking change which fixes an issue)
    • New feature (non-breaking change which adds functionality)
    • Breaking change (fix or feature that would cause existing functionality to change)
    • Documentation update

    Checklist

    • I have read the MCP Documentation
    • My code follows the repository's style guidelines
    • New and existing tests pass locally
    • I have added appropriate error handling
    • I have added or updated documentation as needed

    Additional context

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