Skip to content

Conversation

karenyrx
Copy link
Contributor

@karenyrx karenyrx commented Oct 8, 2025

Description

The existing GRPC errors returned only give the top level error, for example:

ERROR:
  Code: InvalidArgument
  Message: SearchPhaseExecutionException[all shards failed]

With this change, it will add more details (matching the HTTP one), which make it easier to debug, for example:

ERROR:
  Code: InvalidArgument
  Message: SearchPhaseExecutionException[all shards failed]; details={"error":{"root_cause":[{"type":"query_shard_exception","reason":"Geometry fields do not support exact searching, use dedicated geometry queries instead: [location]","index":"test","index_uuid":"drv9MB6_RiWXddWq8us9Yg"}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"test","node":"NFPsaNPMQC2BMVpjSIMQ_A","reason":{"type":"query_shard_exception","reason":"Geometry fields do not support exact searching, use dedicated geometry queries instead: [location]","index":"test","index_uuid":"drv9MB6_RiWXddWq8us9Yg"}}]},"status":400}

which matches the HTTP one:


{
  "error": {
    "root_cause": [
      {
        "type": "query_shard_exception",
        "reason": "Geometry fields do not support exact searching, use dedicated geometry queries instead: [location]",
        "index": "test",
        "index_uuid": "odCbh3PYRJqHOg5Z9we4cg"
      }
    ],
    "type": "search_phase_execution_exception",
    "reason": "all shards failed",
    "phase": "query",
    "grouped": true,
    "failed_shards": [
      {
        "shard": 0,
        "index": "test",
        "node": "T-rqfJP1TbCbEnvqVUptFA",
        "reason": {
          "type": "query_shard_exception",
          "reason": "Geometry fields do not support exact searching, use dedicated geometry queries instead: [location]",
          "index": "test",
          "index_uuid": "odCbh3PYRJqHOg5Z9we4cg"
        }
      }
    ]
  },
  "status": 400
}

A point to note is that it will return the HTTP status code as well ("status": 400) in GRPC error responses. Amenable to opinions if this is a blocker, but have left the entire XContent output here without modifications for now.

Related Issues

Resolves #18926

Check List

  • Functionality includes testing.
  • API changes companion pull request created, if applicable.
  • Public documentation issue/PR created, if applicable.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@github-actions github-actions bot added enhancement Enhancement or improvement to existing feature or request Libraries Lucene Upgrades and Libraries, Any 3rd party library that Core depends on, ex: nebula; team is respo labels Oct 8, 2025
Copy link
Contributor

@msfroh msfroh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! This is a lot more helpful.

Copy link
Contributor

github-actions bot commented Oct 8, 2025

❌ Gradle check result for 96b24d1: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Contributor

github-actions bot commented Oct 8, 2025

❕ Gradle check result for 786c030: UNSTABLE

Please review all flaky tests that succeeded after retry and create an issue if one does not already exist to track the flaky failure.

Copy link

codecov bot commented Oct 8, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.94%. Comparing base (2bb5e33) to head (786c030).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main   #19568      +/-   ##
============================================
- Coverage     73.04%   72.94%   -0.10%     
+ Complexity    70587    70479     -108     
============================================
  Files          5719     5719              
  Lines        323288   323301      +13     
  Branches      46818    46818              
============================================
- Hits         236147   235835     -312     
- Misses        68154    68370     +216     
- Partials      18987    19096     +109     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement or improvement to existing feature or request Libraries Lucene Upgrades and Libraries, Any 3rd party library that Core depends on, ex: nebula; team is respo
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request] GRPC Status Codes and Error Handling
3 participants