Email - an error occured while displaying this card. ERROR metabase.pulse.render Pulse card render error,java.lang.ClassCastException

Hi,

I've found multiple similar issues, but no fix has worked for me yet. I have a couple of static embed dashboards, all working fine. However, when I test sending these dashboards in emails, there is always an issue with displaying some of the charts.

Here is an example:
What I expect to receive (chart from dashboard)
image

What I receive in email:
image

What do the logs say:

[7cf282d2-0602-421e-9573-11c11f660c8e] 2024-08-19T09:18:48+02:00 DEBUG metabase.server.middleware.log GET /api/dashboard/95 200 40.9 ms (10 DB calls) App DB connections: 1/15 Jetty threads: 5/50 (13 idle, 0 queued) (115 total active threads) Queries in flight: 0 (0 queued) {:metabase-user-id 48}
[7cf282d2-0602-421e-9573-11c11f660c8e] 2024-08-19T09:18:48+02:00 DEBUG metabase.server.middleware.log GET /api/dashboard/95/query_metadata 200 91.7 ms (48 DB calls) App DB connections: 0/15 Jetty threads: 4/50 (13 idle, 0 queued) (117 total active threads) Queries in flight: 0 (0 queued) {:metabase-user-id 48}
[7cf282d2-0602-421e-9573-11c11f660c8e] 2024-08-19T09:18:48+02:00 DEBUG metabase.server.middleware.log GET /api/pulse/form_input 200 232.7 µs (0 DB calls) App DB connections: 0/15 Jetty threads: 7/50 (10 idle, 0 queued) (117 total active threads) Queries in flight: 0 (0 queued) {:metabase-user-id 48}
[7cf282d2-0602-421e-9573-11c11f660c8e] 2024-08-19T09:18:49+02:00 DEBUG metabase.server.middleware.log GET /api/pulse/form_input 200 344.2 µs (0 DB calls) App DB connections: 0/15 Jetty threads: 4/50 (12 idle, 0 queued) (120 total active threads) Queries in flight: 3 (0 queued) {:metabase-user-id 48}
[7cf282d2-0602-421e-9573-11c11f660c8e] 2024-08-19T09:18:49+02:00 DEBUG metabase.server.middleware.log GET /api/user/recipients 200 4.0 ms (2 DB calls) App DB connections: 1/15 Jetty threads: 5/50 (12 idle, 0 queued) (120 total active threads) Queries in flight: 3 (0 queued) {:metabase-user-id 48}
[7cf282d2-0602-421e-9573-11c11f660c8e] 2024-08-19T09:18:49+02:00 DEBUG metabase.server.middleware.log GET /api/pulse 200 7.0 ms (5 DB calls) App DB connections: 0/15 Jetty threads: 4/50 (12 idle, 0 queued) (120 total active threads) Queries in flight: 3 (0 queued) {:metabase-user-id 48}
[7cf282d2-0602-421e-9573-11c11f660c8e] 2024-08-19T09:18:50+02:00 DEBUG metabase.server.middleware.log POST /api/dashboard/95/dashcard/818/card/797/query 202 [ASYNC: completed] 1.6 s (25 DB calls) App DB connections: 1/15 Jetty threads: 3/50 (12 idle, 0 queued) (120 total active threads) Queries in flight: 3 (0 queued); postgres DB 3 connections: 0/3 (0 threads blocked) {:metabase-user-id 48}
[7cf282d2-0602-421e-9573-11c11f660c8e] 2024-08-19T09:18:50+02:00 DEBUG metabase.server.middleware.log POST /api/dashboard/95/dashcard/946/card/966/query 202 [ASYNC: completed] 1.6 s (24 DB calls) App DB connections: 2/15 Jetty threads: 3/50 (12 idle, 0 queued) (120 total active threads) Queries in flight: 1 (0 queued); postgres DB 3 connections: 1/3 (0 threads blocked) {:metabase-user-id 48}
[7cf282d2-0602-421e-9573-11c11f660c8e] 2024-08-19T09:18:51+02:00 DEBUG metabase.server.middleware.log POST /api/dashboard/pivot/95/dashcard/800/card/794/query 202 [ASYNC: completed] 3.1 s (39 DB calls) App DB connections: 1/15 Jetty threads: 3/50 (12 idle, 0 queued) (120 total active threads) Queries in flight: 0 (0 queued); postgres DB 3 connections: 0/3 (0 threads blocked) {:metabase-user-id 48}
[7cf282d2-0602-421e-9573-11c11f660c8e] 2024-08-19T09:18:58+02:00 ERROR metabase.pulse.render Pulse card render error,java.lang.ClassCastException
[7cf282d2-0602-421e-9573-11c11f660c8e] 2024-08-19T09:18:58+02:00 INFO metabase.public-settings.premium-features Checking with the MetaStore to see whether token '8ac2...3710' is valid...
[7cf282d2-0602-421e-9573-11c11f660c8e] 2024-08-19T09:18:59+02:00 DEBUG metabase.server.middleware.log GET /api/setting 200 367.4 ms (28 DB calls) App DB connections: 1/15 Jetty threads: 6/50 (11 idle, 0 queued) (120 total active threads) Queries in flight: 0 (0 queued) {:metabase-user-id 48}
[7cf282d2-0602-421e-9573-11c11f660c8e] 2024-08-19T09:18:59+02:00 DEBUG metabase.server.middleware.log GET /api/session/properties 200 366.2 ms (12 DB calls) App DB connections: 0/15 Jetty threads: 6/50 (11 idle, 0 queued) (120 total active threads) Queries in flight: 0 (0 queued) {:metabase-user-id 48}
[7cf282d2-0602-421e-9573-11c11f660c8e] 2024-08-19T09:18:59+02:00 DEBUG metabase.server.middleware.log GET /api/session/properties 200 14.1 ms (12 DB calls) App DB connections: 0/15 Jetty threads: 6/50 (11 idle, 0 queued) (122 total active threads) Queries in flight: 0 (0 queued) {:metabase-user-id 48}
[7cf282d2-0602-421e-9573-11c11f660c8e] 2024-08-19T09:18:59+02:00 DEBUG metabase.server.middleware.log GET /api/setting 200 24.7 ms (27 DB calls) App DB connections: 0/15 Jetty threads: 6/50 (11 idle, 0 queued) (122 total active threads) Queries in flight: 0 (0 queued) {:metabase-user-id 48}
[7cf282d2-0602-421e-9573-11c11f660c8e] 2024-08-19T09:18:59+02:00 DEBUG metabase.server.middleware.log POST /api/pulse/test 200 4.3 s (141 DB calls) App DB connections: 0/15 Jetty threads: 4/50 (11 idle, 0 queued) (122 total active threads) Queries in flight: 0 (0 queued); postgres DB 3 connections: 0/3 (0 threads blocked) {:metabase-user-id 48}
[7cf282d2-0602-421e-9573-11c11f660c8e] 2024-08-19T09:18:59+02:00 DEBUG metabase.server.middleware.log GET /api/setup/admin_checklist 200 11.2 ms (11 DB calls) App DB connections: 0/15 Jetty threads: 5/50 (12 idle, 0 queued) (122 total active threads) Queries in flight: 0 (0 queued) {:metabase-user-id 48}
[7cf282d2-0602-421e-9573-11c11f660c8e] 2024-08-19T09:18:59+02:00 DEBUG metabase.server.middleware.log GET /api/util/bug_report_details 200 4.1 ms (1 DB calls) App DB connections: 0/15 Jetty threads: 4/50 (12 idle, 0 queued) (122 total active threads) Queries in flight: 0 (0 queued) {:metabase-user-id 48}

Any ideas? Such a weird behavior

What version of metabase are you running?

We're currently running 1.50.19

Can you upgrade to 50.20 and try again, I believe you are hitting this:

But only happens to funnel charts now

Ahh, amazing!

That actually worked. I had an ID as first column, which broke the chart. After removing the ID (which was not necessary anyways), the email notification shows the card as it is suppoed to.

Before
image

After
image

What I receive in email:

Thanks a ton @TonyC!

Awesome! I believe if you move to 50.20 you should not be required to do that change :slight_smile:

Hi @TonyC,

we've upgraded to 50.20 and the issue still persists. Additionally, the solution mentioned above degrades the quality of our reports, as it limits our sorting options (we are currently sorting by event_type_id and that allows us to show meaningful sorts on the charts).

Here is a copy of the list of things we've tried to overcome the issue, with none of them working as needed. Any tips?

What we’ve tried

1) Changing the order of fields ID and type :x:

  1. setup - text is first, ID is second. Order by ID stays

image

  1. result in dashboard :white_check_mark:
    1. no change

image

  1. result in mail :x:
    1. the pie shows the ID numerical values as the values to be shown in the chart (sum of IDs = 15)

2) Creating a new column to order by :x:

  1. setup - creating a new column combining ID and type, sorting by the new column

image

image

  1. result in dashboard :white_check_mark: - all works nicely

image

  1. result in mail :x: - error occured

image

3) Combination of the first two - new column, change order of columns :x:

image

  • same result - card does not show in email

4) Removing ids

Remove grouping by ids - texts only. This will make the charts work, but degrades the sorting options.

Before

image

After

image

Issue

  • sorting issue, we cannot sort by ids so the sort is distorted
    • instead of this sort

image

- we will have this sort

image

5) Duplicating reports
Another option would be to maintain two dashboards - one for embedding and one for email sending. DEFINITELY DON'T WANT TO GO THERE