use this instead
user_doc = frappe.get_doc('User', frappe.user)
has_special_role = [r for r in user_doc.roles if r.role == 'System Manager']
Can share how you are using get_roles
function?
usr = frappe.session.user
roles = frappe.get_roles(usr)
use frappe.user_roles