Skip to content

Conversation

Kehrlann
Copy link
Contributor

Motivation and Context

Bug: When an error happens during LifecycleInitializer#doInitialize (e.g. HTTP error), then the initializer caches the error and can never re-initialize.

This fix allows the initializer to recover, and subsequent init calls will work.

How Has This Been Tested?

Tested with Spring Security which throws dedicated exceptions to signal that an OAuth2 token should be fetched.
Without this fix, the MCP client gets stuck in an error state ; this fix allows the flow to continue normally.

Breaking Changes

None

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

n/a

@tzolov
Copy link
Contributor

tzolov commented Sep 12, 2025

Thanks @Kehrlann and @chemicL

@tzolov tzolov merged commit 71f318e into modelcontextprotocol:0.12.x Sep 12, 2025
1 check passed
tzolov pushed a commit that referenced this pull request Sep 12, 2025
@Kehrlann Kehrlann deleted the dgarnier/fix-lifecycleinitializer-onerror branch September 12, 2025 18:54
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.

3 participants