Skip to content

[BUG] Empty PPL query returns 500 NullPointerException instead of 400 #5867

Closed

Description

@DdangJin

What is the bug?
POST _plugins/_ppl with {"query": ""} returns 500:
Cannot invoke "org.opensearch.sql.ast.statement.Statement.accept(...)" because "plan" is null.

How can one reproduce the bug?
On 3.8.0: POST _plugins/_ppl {"query": ""}.

What is the expected behavior?
400 with a syntax error (e.g. "query is empty").

Analysis (code reading)
root: pplStatement? EOF accepts empty input, AstStatementBuilder returns null, and anonymizeStatement(null) throws:
https://github.com/opensearch-project/sql/blob/3.8.0.0/ppl/src/main/java/org/opensearch/sql/ppl/PPLService.java#L93-L114
https://github.com/opensearch-project/sql/blob/3.8.0.0/ppl/src/main/java/org/opensearch/sql/ppl/utils/PPLQueryDataAnonymizer.java#L152-L153
NPE is not classified as a client error, so it maps to 500. main still calls anonymizeStatement(statement) without a null check (I did not verify whether empty input is rejected earlier on main).

What is your host/environment? OpenSearch 3.8.0, SQL plugin 3.8.0.0
Related: opensearch-project/OpenSearch-Dashboards#12940

Activity

  1. added
    bugSomething isn't working
    PPLPiped processing language
    and removed on Oct 13, 2026
  2. ahkcs commented on Oct 13, 2026

    @ahkcs
    Collaborator
  3. RyanL1997 commented on Oct 13, 2026

    @RyanL1997
    Collaborator

    Hi @DdangJin, thanks for reporting this. Drafted a PR for the fix: #5868

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    PPLPiped processing languagebugSomething isn't working

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions