Skip to content

fix: propagate errors from listCollections() instead of returning empty list#112

Merged
epugh merged 1 commit into
apache:mainfrom
adityamparikh:fix/list-collections-error-propagation
May 8, 2026
Merged

fix: propagate errors from listCollections() instead of returning empty list#112
epugh merged 1 commit into
apache:mainfrom
adityamparikh:fix/list-collections-error-propagation

Conversation

@adityamparikh
Copy link
Copy Markdown
Contributor

Summary

  • Remove silent error swallowing in listCollections() -- let SolrServerException/IOException propagate
  • When Solr is unreachable, the MCP client now receives an error instead of an empty list
  • Prevents the AI from incorrectly telling users "there are no collections" when Solr is down

Test plan

  • ./gradlew build passes
  • ./gradlew nativeTest -Pnative passes (119/119 tests)
  • No regressions

🤖 Generated with Claude Code

@adityamparikh adityamparikh force-pushed the fix/list-collections-error-propagation branch from 9e51255 to baeaa55 Compare May 2, 2026 17:04
…ty list

When Solr is unreachable, listCollections() was catching
SolrServerException/IOException and returning an empty list.  This caused
the MCP client to incorrectly tell users "there are no collections"
instead of reporting a connection error.

Remove the try-catch and let checked exceptions propagate through
listCollections(), validateCollectionExists(), and their callers so the
MCP framework can surface a proper error to the client.

Closes #3

Signed-off-by: Aditya Parikh <aditya.m.parikh@gmail.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: adityamparikh <aditya.m.parikh@gmail.com>
@adityamparikh adityamparikh force-pushed the fix/list-collections-error-propagation branch from baeaa55 to 2d40162 Compare May 8, 2026 21:10
@epugh epugh merged commit c7b2529 into apache:main May 8, 2026
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.

2 participants