I recently ran into this error message and am posting an answer here so that the solution is easily searchable in the future.
Problem: The following query returns an error message when run on Amazon Redshift. What does it mean and does Amazon Redshift support the 'median' aggregate?
dev=# select median(5);
ERROR: cache lookup failed for aggregate 2762