vitessio/vitess · error
error fetching current user: %w
Error message
error fetching current user: %w
What it means
When loadFlags request loadUsers deletion (shouldDeleteUsers), cleanupMySQL first runs `SELECT user()` to identify the current connection's user so it isn't dropped. This error wraps a failure of that fetch.
Source
Thrown at go/vt/mysqlctl/mysqlshellbackupengine.go:638
for _, row := range result.Rows {
dbName := row[0].ToString()
if slices.Contains(internalDBs, dbName) {
continue // not dropping internal DBs
}
params.Logger.Infof("Dropping DB %q", dbName)
err = params.Mysqld.ExecuteSuperQuery(ctx, fmt.Sprintf("DROP DATABASE IF EXISTS `%s`", row[0].ToString()))
if err != nil {
return fmt.Errorf("error droppping database %q: %w", row[0].ToString(), err)
}
}
if shouldDeleteUsers {
// get current user
var currentUser string
result, err = params.Mysqld.FetchSuperQuery(ctx, "SELECT user()")
if err != nil {
return fmt.Errorf("error fetching current user: %w", err)
}
for _, row := range result.Rows {
currentUser = row[0].ToString()
}
// drop all users except reserved ones
result, err = params.Mysqld.FetchSuperQuery(ctx, "SELECT user, host FROM mysql.user")
if err != nil {
return err
}
for _, row := range result.Rows {
user := fmt.Sprintf("%s@%s", row[0].ToString(), row[1].ToString())
if user == currentUser {
continue // we don't drop the current user
}View on GitHub (pinned to 01a25a7d17)
Solutions
- Verify mysqld is still up and the super-query connection is healthy, then retry
- Check the wrapped inner error for the root cause (auth, connection, permissions)
- Avoid enabling user deletion (loadUsers flag) if the restore only needs schema/data cleanup
Defensive patterns
Strategy: retry
Validate before calling
// health-check the super-query connection before restore
if err := mysqld.ExecuteSuperQuery(ctx, "SELECT 1"); err != nil {
log.Warn("mysqld connection unhealthy before restore", slog.Any("error", err))
} Try / catch
if _, err := engine.ExecuteRestore(ctx, params, backupDir); err != nil {
if strings.Contains(err.Error(), "error fetching current user") {
// check connectivity/auth, then retry restore
}
} Prevention
- Avoid enabling user deletion unless it is genuinely needed
- Monitor connection stability between tablet and mysqld during restores
- Confirm the DBA account can run SELECT user()
When it happens
Trigger: ExecuteRestore -> cleanupMySQL with shouldDeleteUsers=true when params.Mysqld.FetchSuperQuery(ctx, "SELECT user()") returns an error (connection dropped or query rejected).
Common situations: Connection to mysqld lost between cleanup steps; DBA user lacking privileges to execute SELECT user() via the super-query path; server shutting down mid-restore.
Related errors
- error droppping user %q: %w
- %w: "progressFile" needs to be empty as vitess always starts
- %w: "skipBinlog" needs to set to true
- %w: failed to fetch MySQL version: %v
- %w: failed to parse MySQL version (version: %s): %v
AI-assisted analysis of vitessio/vitess@01a25a7d17 (2026-09-01).
Data as JSON: /api/errors/48b73e3c218eba71.
Report an issue: GitHub.