INTERNAL ERROR

Anonymous
Not applicable

I have the following query;

select  customer_id,
    first(if(name_type = 'Official', name, null),true) official_name,
    first(if(name_type = 'Preferred', name, null),true) preferred_name
from
(
    select  customer_id,
        ifnull(name_type, 'Official') name_type,
        map(
          'title', title,
          'given_name', given_name,
          'surname', surname,
          'middle_name', middle_name,
          'initials', initials,
          'full', surname || ', ' || given_name
        ) name
    from  customer_name
    where   name_status = 'Active'
)
group by customer_id
 
If I run this query against a SQL Warehouse cluster, I get the message Internal error.
 
If I run the same query against a standard compute cluster, I don't get an error.
 
Not only am I wanting to understand why the error is occurring, but how do I debug something so non-specific as Internal error.