Your Question

Unknown prepared statement handler (401) given to mysqld_stmt_execute .

func UserGet(where string, args ...interface{}) (User, error) { var lst []User err := DB().Where(where, args...).Find(&lst).Error if err != nil { return nil, err }

if len(lst) == 0 {
    return nil, nil
}

lst[0].RolesLst = strings.Fields(lst[0].Roles)
lst[0].Admin = lst[0].IsAdmin()

return lst[0], nil

}

The document you expected this should be explained

Expected answer

why this code sometimes report err. the err msg is :Unknown prepared statement handler (401) given to mysqld_stmt_execute .

Comment From: github-actions[bot]

This issue has been automatically marked as stale because it has been open 360 days with no activity. Remove stale label or comment or this will be closed in 180 days

Comment From: saeidee

This is related to the MySQL engine, not GORM.