Skip to content

[#885] Fix MCP client initialization error handling#1142

Open
shruthikha wants to merge 1 commit intoagentscope-ai:mainfrom
shruthikha:fix-mcp-init-error
Open

[#885] Fix MCP client initialization error handling#1142
shruthikha wants to merge 1 commit intoagentscope-ai:mainfrom
shruthikha:fix-mcp-init-error

Conversation

@shruthikha
Copy link
Copy Markdown

Enhanced error handling during MCP client initialization.

AgentScope-Java Version

Latest (based on current main branch)

Description

Previously, MCP client initialization failures were only logged using doOnError, without properly propagating the error or resetting the client state. This could lead to silent failures and inconsistent behavior.

This PR improves reliability by:

  • Resetting the initialized flag to false when initialization fails
  • Propagating the error using onErrorResume instead of silently logging
  • Ensuring failures are visible to the caller for better debugging

Checklist

  • Code has been formatted with mvn spotless:apply
  • All tests are passing (mvn test)
  • Javadoc comments are complete and follow project conventions
  • Related documentation has been updated (e.g. links, examples, etc.)
  • Code is ready for review

Enhanced error handling during MCP client initialization.
@shruthikha shruthikha requested a review from a team April 5, 2026 16:53
@cla-assistant
Copy link
Copy Markdown

cla-assistant bot commented Apr 5, 2026

CLA assistant check
All committers have signed the CLA.

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