t8y2/dbx · error
close Hive initFile statement result: %w
Error message
close Hive initFile statement result: %w
What it means
When closing the Rows handle for an initFile statement result set returns an error, the driver wraps it as this error and aborts connection initialization. A close failure means the driver could not cleanly release the server-side operation/result resources for that statement.
Source
Thrown at agents/drivers/hive-go/main.go:384
}
func runHiveInitStatements(ctx context.Context, connection *sql.Conn, statements []string, fetchSize int) error {
for _, statement := range statements {
rows, _, hasResultSet, err := executeHiveStatement(ctx, connection, statement, fetchSize)
if err != nil {
return fmt.Errorf("execute Hive initFile statement: %w", err)
}
if !hasResultSet {
continue
}
for rows.Next() {
}
if rowsErr := rows.Err(); rowsErr != nil {
_ = rows.Close()
return fmt.Errorf("read Hive initFile statement result: %w", rowsErr)
}
if closeErr := rows.Close(); closeErr != nil {
return fmt.Errorf("close Hive initFile statement result: %w", closeErr)
}
}
return nil
}
func (server *server) dispatch(method string, params map[string]json.RawMessage) (any, bool, error) {
switch method {
case "validate_connection":
return map[string]bool{"ok": true}, false, server.validateConnection()
case "connection_info":
result, err := server.connectionInfo()
return result, false, err
case "list_databases":
result, err := server.listDatabases()
return result, false, err
case "list_schemas":
result, err := server.listSchemas(stringSliceParam(params, "visible_schemas"))
return result, false, errView on GitHub (pinned to c0390bff16)
Solutions
- Inspect the wrapped cause after 'close Hive initFile statement result:' for the transport error
- Retry the connection; if close errors persist, check network stability to HiveServer2
- Verify hive.server2 idle/operation timeouts aren't closing operations mid-init
- Keep initFile free of statements producing large result sets so close happens quickly
Defensive patterns
Strategy: retry
Try / catch
if err != nil && strings.HasPrefix(err.Error(), "close Hive initFile statement result:") {
log.Printf("init result cleanup failed, retrying: %v", err)
return reconnect(ctx)
} Prevention
- Use only non-result-set statements (SET/USE/DDL) in initFile
- Check network reliability and HiveServer2 operation timeouts
- Avoid long-running work on the bootstrap connection
When it happens
Trigger: rows.Close() returns non-nil after draining an initFile statement's result set — typically an underlying transport error to HiveServer2 (connection reset, cancelled operation) surfaced at close time.
Common situations: Network interruption during connection bootstrap; HiveServer2 closing the session while the init statement's operation is still open; thrift transport errors on flaky connections.
Related errors
- close Hive initFile statement result: %w
- execute Hive initFile statement: %w
- read Hive initFile statement result: %w
- Hive host is required
- Hive connection string must start with jdbc:hive2:// or hive
AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05).
Data as JSON: /api/errors/c9fa2bbeccb5c22e.
Report an issue: GitHub.