infiniflow/ragflow · error · Exception
SQL for `ExeSQL` MUST not be empty.
Error message
SQL for `ExeSQL` MUST not be empty.
What it means
Error "SQL for `ExeSQL` MUST not be empty." thrown in infiniflow/ragflow.
Source
Thrown at agent/tools/exesql.py:97
from decimal import Decimal
import math
if isinstance(obj, float):
# Handle NaN and Infinity which are not valid JSON values
if math.isnan(obj) or math.isinf(obj):
return None
return obj
if isinstance(obj, Decimal):
return float(obj) # 或 str(obj)
elif isinstance(obj, dict):
return {k: convert_decimals(v) for k, v in obj.items()}
elif isinstance(obj, list):
return [convert_decimals(item) for item in obj]
return obj
sql = kwargs.get("sql")
if not sql:
raise Exception("SQL for `ExeSQL` MUST not be empty.")
if self.check_if_canceled("ExeSQL processing"):
return
vars = self.get_input_elements_from_text(sql)
args = {}
for k, o in vars.items():
args[k] = o["value"]
if not isinstance(args[k], str):
try:
args[k] = json.dumps(args[k], ensure_ascii=False)
except Exception:
args[k] = str(args[k])
self.set_input_value(k, args[k])
sql = self.string_format(sql, args)
if self.check_if_canceled("ExeSQL processing"):
returnView on GitHub (pinned to 554fb1133a)
Solutions
- Provide a non-empty SQL statement for the ExeSQL tool.
- Check that the sql parameter is passed and not blank after trimming.
Example fix
sql = 'SELECT id, name FROM users LIMIT 10'
When it happens
Trigger: Thrown at agent/tools/exesql.py:97 when the library encounters an invalid state.
Common situations: The ExeSQL tool is called with an empty or whitespace-only SQL string, often from a missing template variable; validating the SQL before execution prevents this error.
AI-assisted analysis of infiniflow/ragflow@554fb1133a (2026-08-15).
Data as JSON: /api/errors/e89becffd81bbc92.
Report an issue: GitHub.