getredash/redash · warning · QueryParseError
Query is empty.
Error message
Query is empty.
What it means
json_ds (JSON URL) queries must be a YAML document. parse_query strips whitespace and rejects empty input with QueryParseError('Query is empty.') before YAML parsing.
Source
Thrown at redash/query_runner/json_ds.py:27
TYPE_BOOLEAN,
TYPE_DATETIME,
TYPE_FLOAT,
TYPE_INTEGER,
TYPE_STRING,
BaseHTTPQueryRunner,
register,
)
class QueryParseError(Exception):
pass
def parse_query(query):
# TODO: copy paste from Metrica query runner, we should extract this into a utility
query = query.strip()
if query == "":
raise QueryParseError("Query is empty.")
try:
params = yaml.safe_load(query)
return params
except ValueError as e:
logging.exception(e)
error = str(e)
raise QueryParseError(error)
TYPES_MAP = {
str: TYPE_STRING,
bytes: TYPE_STRING,
int: TYPE_INTEGER,
float: TYPE_FLOAT,
bool: TYPE_BOOLEAN,
datetime.datetime: TYPE_DATETIME,
}
View on GitHub (pinned to ca79fe988d)
Solutions
- Write a minimal valid YAML object such as 'url: https://api.example.com/items'
- Guard scripts to skip execution when query.strip() is empty
Example fix
# before "" # after url: https://api.example.com/items
Defensive patterns
Strategy: validation
Validate before calling
def is_runnable_json_ds_query(q: str) -> bool:
return bool(q and q.strip()) Try / catch
try:
data, error = runner.run_query(q, user)
except QueryParseError as e:
if str(e) == "Query is empty.":
skip_execution_and_prompt_user() Prevention
- Disable run for empty editors in dashboards
- Trim and sanity-check query text in automation scripts
When it happens
Trigger: Executing a query containing only whitespace/newlines in a JSON URL data source, or a default/new empty query editor being run.
Common situations: Accidentally hitting run on an unsaved/blank query, clearing the editor before running, automation sending empty query text.
Related errors
- Query should be a YAML object describing the URL to query.
- Query must include 'url' option.
- Only GET or POST methods are allowed.
- 'fields' needs to be a list.
- 'pagination' should be an object with a `type` property
AI-assisted analysis of getredash/redash@ca79fe988d (2026-08-28).
Data as JSON: /api/errors/d3fcca9d6efc4e33.
Report an issue: GitHub.