You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] SQL returns 500 StringIndexOutOfBoundsException for an empty cursor #5983
What is the bug?
A request with an empty cursor returns HTTP 500 with StringIndexOutOfBoundsException. This is a bad request, so it should return 400.
How can one reproduce the bug?
POST _plugins/_sql
{"cursor": ""}
{
"error": {
"reason": "There was internal problem at backend",
"details": "Range [0, 1) out of bounds for length 0",
"type": "StringIndexOutOfBoundsException"
},
"status": 500
}
POST _plugins/_sql/close with the same body returns the same 500.
What is the expected behavior?
HTTP 400 with a message that the cursor is empty or invalid.
What is your host/environment?
main at 135d7db (3.10.0-SNAPSHOT), local integTest cluster
Plugins: opensearch-sql
Do you have any additional context? RestSqlAction.isLegacyCursor calls cursor.substring(0, 1) without checking for an empty string (line 251). Both endpoints are handled by RestSqlAction.
I'd like to work on this. I have a fix ready that returns HTTP 400 with "Cursor is empty or invalid" for an empty cursor on both _plugins/_sql and _plugins/_sql/close.
Activity
shuseng8 commentedon Nov 26, 2026
I'd like to work on this. I have a fix ready that returns HTTP 400 with "Cursor is empty or invalid" for an empty cursor on both
_plugins/_sqland_plugins/_sql/close.[BugFix] Return 400 for an empty SQL cursor (#5983) (#5992)