This is an automated email from the ASF dual-hosted git repository.
epugh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr-mcp.git
The following commit(s) were added to refs/heads/main by this push:
new 90706b3d fix(search): log remediated search failures at WARN and state
the no-cause invariant (#212)
90706b3d is described below
commit 90706b3d178d983c0870d264e2c6bc1a31af1dc0
Author: Aditya Parikh <[email protected]>
AuthorDate: Tue Oct 6 14:53:11 2026 -0400
fix(search): log remediated search failures at WARN and state the no-cause
invariant (#212)
withRemediationHint() returns exceptions with no cause on purpose: the MCP
annotation layer reports the root cause's message as the tool error, so
attaching the Solr failure would replace the guidance the client needs.
That makes this log line the only server-side record of the failure, so
raise it from debug to warn, matching the other backend-failure paths in
search(). The javadoc and comment state the invariant where a contributor
would otherwise re-add the cause.
Signed-off-by: Aditya Parikh <[email protected]>
Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
---
.../java/org/apache/solr/mcp/server/search/SearchService.java | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/main/java/org/apache/solr/mcp/server/search/SearchService.java
b/src/main/java/org/apache/solr/mcp/server/search/SearchService.java
index 356209b6..05b3a0e4 100644
--- a/src/main/java/org/apache/solr/mcp/server/search/SearchService.java
+++ b/src/main/java/org/apache/solr/mcp/server/search/SearchService.java
@@ -348,13 +348,17 @@ public class SearchService {
* the Solr exception raised by the query
* @param collection
* the collection that was queried
- * @return an exception carrying safe guidance without a cause
+ * @return an exception carrying safe guidance; never with a cause,
which MCP
+ * would unwrap in place of the guidance
*/
private static RuntimeException withRemediationHint(SolrException e,
String collection) {
final String message = String.valueOf(e.getMessage());
- // Keep diagnostics in server logs, not in the client-facing
exception chain.
- logger.debug("Solr query failed on collection {}", collection,
e);
+ // Deliberately no cause on the exceptions below: the MCP
annotation layer
+ // reports the ROOT cause's message as the tool error, so
attaching the Solr
+ // failure would discard the guidance and the client would
never see it. This
+ // log is therefore the only server-side record of the failure.
+ logger.warn("Solr query failed on collection {}", collection,
e);
// An unknown collection is a 404 whose body is Solr's HTML
"not found" page,
// so SolrJ reports it as a mime-type mismatch and leaves
getMetadata() null.