Internal Server Error Sqlite time series

Hi!
I’m running Grafana on local Windows 10 computer. My data source is sqlite. The data base is updated every 1-2 sec. with new sensor data.
I created a dashboard and it works fine when in editing mode. However when i make the dashboard public i’m getting “Internal Server Error” for time series plot. The gage panel works ok. My sql:
Editing and public viewing on localhost with the intention to make it available over local network.

WITH window_avg AS (
    SELECT 
        id,
        Y1_b,
        AVG(Y1_b) OVER (ORDER BY id DESC ROWS BETWEEN 1999 PRECEDING AND CURRENT ROW) AS avg_Y1_b,
        CAST(id / 1000 AS INTEGER) AS time,
        CASE 
            WHEN Y1_b > 1.1 * AVG(Y1_b) OVER (ORDER BY id DESC ROWS BETWEEN 1999 PRECEDING AND CURRENT ROW) THEN NULL
            ELSE Y1_b 
        END AS Y_clean
    FROM 
        day_2024_2_16
    ORDER BY 
        id DESC
    LIMIT 600 -- Consider only the latest 2000 values based on id
)
SELECT 
    time,
    Y1_b/0.41,
    AVG(Y_clean/0.41) OVER (ORDER BY id DESC ROWS BETWEEN 10 PRECEDING AND CURRENT ROW) AS Y_clean_avg
FROM 
    window_avg;

Please help

image