{"record":{"id":"d3fcca9d6efc4e33","repo":"getredash/redash","slug":"query-is-empty","errorCode":null,"errorMessage":"Query is empty.","messagePattern":"Query is empty\\.","errorType":"validation","errorClass":"QueryParseError","httpStatus":null,"severity":"warning","filePath":"redash/query_runner/json_ds.py","lineNumber":27,"sourceCode":"    TYPE_BOOLEAN,\n    TYPE_DATETIME,\n    TYPE_FLOAT,\n    TYPE_INTEGER,\n    TYPE_STRING,\n    BaseHTTPQueryRunner,\n    register,\n)\n\n\nclass QueryParseError(Exception):\n    pass\n\n\ndef parse_query(query):\n    # TODO: copy paste from Metrica query runner, we should extract this into a utility\n    query = query.strip()\n    if query == \"\":\n        raise QueryParseError(\"Query is empty.\")\n    try:\n        params = yaml.safe_load(query)\n        return params\n    except ValueError as e:\n        logging.exception(e)\n        error = str(e)\n        raise QueryParseError(error)\n\n\nTYPES_MAP = {\n    str: TYPE_STRING,\n    bytes: TYPE_STRING,\n    int: TYPE_INTEGER,\n    float: TYPE_FLOAT,\n    bool: TYPE_BOOLEAN,\n    datetime.datetime: TYPE_DATETIME,\n}\n","sourceCodeStart":9,"sourceCodeEnd":45,"githubUrl":"https://github.com/getredash/redash/blob/ca79fe988d81cdac9675b412f3dfcab107bc1fbc/redash/query_runner/json_ds.py#L9-L45","documentation":"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.","triggerScenarios":"Executing a query containing only whitespace/newlines in a JSON URL data source, or a default/new empty query editor being run.","commonSituations":"Accidentally hitting run on an unsaved/blank query, clearing the editor before running, automation sending empty query text.","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"],"exampleFix":"# before\n\"\"\n# after\nurl: https://api.example.com/items","handlingStrategy":"validation","validationCode":"def is_runnable_json_ds_query(q: str) -> bool:\n    return bool(q and q.strip())","typeGuard":null,"tryCatchPattern":"try:\n    data, error = runner.run_query(q, user)\nexcept QueryParseError as e:\n    if str(e) == \"Query is empty.\":\n        skip_execution_and_prompt_user()","preventionTips":["Disable run for empty editors in dashboards","Trim and sanity-check query text in automation scripts"],"tags":["json-ds","query-validation","yaml"],"backgroundTag":"empty-query","analyzedSha":"ca79fe988d81cdac9675b412f3dfcab107bc1fbc","analyzedAt":"2026-08-28T18:32:34.637Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}