opensearch-project / opensearch-project/sql

[META] Error Handling Enhancements

Open
#5,261 0 comments 0 reactions 1 assignee View on GitHub

@Swiddis is already working on this.

Since Mar 24, 2026.

error-experience PPL RFC
Dominant language
Java
Stars
176
Forks
229
Avg merge
2d 21h
Merged PRs (30d)
43

Description

This is a meta issue collecting a few different ideas from different sources.

The core problem is that misbehaving queries are typically hard to debug & require a lot of knowledge of PPL/SQL engine behavior, and there's room for enhancement.

Discussing the concept with @anasalkouz, there are three main problem classes we want to enhance:

  1. Something went wrong (execution error)
  2. 0 results are returned, why?
  3. The query is slow, why?

So, compiling existing issues for the backend:

Once those have reasonably complete implementations, errors will be in structured reports like this:

{
  "status": 400,
  "error": {
    "type": "SemanticCheckException",
    "code": "FIELD_NOT_FOUND",
    "reason": "Invalid Query",
    "details": "Failed to resolve field 'foo'",
    "location": [
      "while planning the query",
      "while resolving fields in the index mapping"
    ],
    "context": {
      "index_pattern": "logs-*",
      "position": {"line": 1, "column": 25},
      "query": "source=logs-* | fields foo",
      "query_id": "b6627794-3939-4ac4-8c5b-821ccc400f4f"
    },
    "suggestion": "Did you mean: 'foobar'"
  }
}

Frontends can choose to do whatever they want with this: render specific fixed pieces of context (e.g. position is pointing to a spot in the query, highlight it?), render details/locations/suggestions, throw it in an LLM, etc. It also helps with oncall debugging when given these responses (either directly or from har files). https://github.com/opensearch-project/sql/issues/4919#issuecomment-3863005661 shows me doing this quickly for the SQL CLI based on a proof-of-concept implementation.

From the frontend, there's a separate meta issue:

Once the core flows here are done, what's left is to start vetting specific error cases:

  • #4771
  • #4872
  • #4869
  • #4896
  • #5065
  • Field not found (issue pending)
  • Suggest syntax rewrites (#5262 is a special case but it'd be nice to do it in the general case)
  • Zero-result & slow query explanations on the frontend
  • Optionally: anything else with the error-experience label. Feel free to suggest some!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.