t8y2/dbx · error
statements are required
Error message
statements are required
What it means
executeStatements validates that the 'statements' parameter carries at least one entry before doing any work. An empty (or missing) statements array yields nothing to execute, so the RPC fails fast with this error.
Source
Thrown at agents/drivers/iotdb/query.go:318
if err := state.dataset.Close(); err != nil && firstErr == nil {
firstErr = err
}
delete(s.querySessions, sessionID)
}
return firstErr
}
func (s *server) executeStatements(params map[string]json.RawMessage, transaction bool) (queryResult, error) {
if transaction {
// IoTDB executes statements independently and exposes no rollbackable
// transaction boundary. Reject the RPC before obtaining a client so a
// requested atomic batch can never leave partial writes behind.
return queryResult{}, errors.New("IoTDB does not support transactions")
}
started := time.Now()
statements := stringSliceParam(params, "statements")
if len(statements) == 0 {
return queryResult{}, errors.New("statements are required")
}
database := strings.TrimSpace(stringParam(params, "schema"))
for _, statement := range statements {
sql := trimStatementSQL(statement)
if sql == "" {
continue
}
if isQueryStatement(sql) {
values, err := s.queryValues(sql, database, defaultMaxRows, 0)
if err != nil {
return queryResult{}, err
}
_ = values
} else if err := s.executeNonQuery(sql, database, 0); err != nil {
return queryResult{}, err
}
}
return queryResult{View on GitHub (pinned to c0390bff16)
Solutions
- Ensure the 'statements' parameter is a non-empty array of SQL strings before calling the RPC
- Filter empty statements before sending; if the filtered list is empty, skip the call entirely
- Validate the RPC payload at the call site and fail with a clearer application-level message
Example fix
// before
executeStatements(map[string]json.RawMessage{"statements": nil}, false)
// after
if len(stmts) == 0 { return nil } // skip the call
executeStatements(map[string]json.RawMessage{"statements": mustMarshal(stmts)}, false) Defensive patterns
Strategy: validation
Validate before calling
if len(statements) == 0 { return errors.New("no statements to execute") } Try / catch
res, err := executeStatements(params, false); if err != nil && err.Error() == "statements are required" { /* fix payload construction */ } Prevention
- Validate the statements array is non-empty before every RPC call
- Trim and drop blank statements before sending; skip the call if nothing remains
- Log the outgoing params when a validation error occurs to catch payload-construction bugs
When it happens
Trigger: Calling the statement-execution RPC with 'statements' absent, null, or an empty array (stringSliceParam returns zero entries).
Common situations: A caller builds the statement list dynamically and all statements were filtered out as empty; a wiring/config mistake drops the statements field from the RPC params; a template renders zero SQL statements.
Understand the failure class
Background: Missing required parameter errors: what 'X is required' and 'the required X param is missing' mean, and how to fix them — this error's family across 27 libraries.
Related errors
- table is required
- lease, ttl, and preserveLease cannot be specified together
- ttl must be a positive integer
- ETCD_WATCH_SCOPE_INVALID
- both client_cert_path and client_key_path are required for I
AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05).
Data as JSON: /api/errors/43719c5b4a783434.
Report an issue: GitHub.