Flux: mean() causes error panic runtime error

I have a simple query

from(bucket: “sensors”)
|> range(start: dashboardTime)
|> filter(fn: ® => r._measurement == “cc_p0”)
|> mean(column: “_value”)

I’m running this in chronograf. If I remove the last line it pulls out the data fine. With the last line in I get:
“Error: Panic: runtime error: invalid memory address or nil pointer dereference.”

Im running influx 1.8.3 with flux enabled. Its the same result no matter what measurement I try to query. The inclusion of mean() causes the panic.
Any ideas?

1 Like

Hello @nicky4tl,
That’s strange.
Can you share the raw data view or output of the query before you include the mean please?

Thank you!

Hi @Anaisdg,
I just ran into the same issue as @nicky4tl . Just found from searching around internet it seems an issue with armv7l (32bit) architecture.
Is there a plan when / if armv7l will be supported?


just found this: Docker Hub

Just ran into the same issue. Any news on this? I’m running InfluxDB on a Raspberry Pi 4 as Home Assistant integration. I haven’t figured out yet how to determine which InfluxDB version it runs.

Has this issue been fixed by now?

Hi i have the same problem also on homeassistant and rpi4. Has anyone found a solution?

Same problem here on my Raspberry Pi 4.

$ apt show influxdb
Package: influxdb
Version: 1.8.10-1
Priority: extra
Section: default
Maintainer: support@influxdb.com
Installed-Size: 148 MB
Depends: curl
Homepage: https://influxdata.com
License: Proprietary
Vendor: InfluxData
Download-Size: 50,7 MB
APT-Manual-Installed: yes
APT-Sources: https://repos.influxdata.com/debian bullseye/stable arm64 Packages
Description: Distributed time-series database.

Maybe this output from chronograf does help (hopefully this thread is still observed by the staff since it’s quite old):
Peek 2022-04-23 00-25

This should be the corresponding output from the influxdb log:

Apr 22 23:25:07 rpi influxd-systemd-start.sh[531345]: ts=2022-04-22T22:25:07.563751Z lvl=info msg="Executed Flux query" log_id=0a0j5sBW000 service=httpd compiler_type=flux response_size=0 query="\n\ndashboardTime = -1h\nupperDashboardTime = 2022-04-22T22:25:07.481Z\nv = { timeRangeStart: dashboardTime , timeRangeStop: upperDashboardTime }\n\nfrom(bucket: \"test/autogen\")\n  |> range(start: -100d)\n  |> filter(fn: (r) => r._measurement == \"my_measurement\")\n  |> window(every: 10m)\n  |> mean()" error="panic: runtime error: invalid memory address or nil pointer dereference" stat_total_duration=24.596ms stat_compile_duration=0.346ms stat_execute_duration=24.242ms stat_max_allocated=2256 stat_total_allocated=5088
Apr 22 23:25:07 rpi influxd-systemd-start.sh[531345]: [httpd] ::1, - pvScript [22/Apr/2022:23:25:07 +0100] "POST /api/v2/query?org=pvScript&organization=defaultorgname HTTP/1.1 " 500 84 "http://[::]:8888/sources/1/chronograf/data-explorer?script=from%28bucket%3A%20%22test%2Fautogen%22%29%0A%20%20%7C%3E%20range%28start%3A%20-100d%29%0A%20%20%7C%3E%20filter%28fn%3A%20%28r%29%20%3D%3E%20r._measurement%20%3D%3D%20%22my_measurement%22%29%0A%20%20%7C%3E%20window%28every%3A%2010m%29%0A%20%20%7C%3E%20mean%28%29" "Mozilla/5.0 (X11; Linux x86_64; rv:98.0) Gecko/20100101 Firefox/98.0" 108a3e2b-c28b-11ec-8131-dca63259d0a1 25821
Apr 22 23:25:07 rpi influxd-systemd-start.sh[531345]: ts=2022-04-22T22:25:07.563931Z lvl=error msg="[500] - \"panic: runtime error: invalid memory address or nil pointer dereference\"" log_id=0a0j5sBW000 service=httpd

And this is the output of chronograf:

INFO[0703] Response: OK                                  component=server method=POST remote_addr="[::1]:60022" response_time=1.357811ms status=200
INFO[0703] Response: Internal Server Error               component=server method=POST remote_addr="[::1]:60022" response_time=101.544322ms status=500

Maybe related, maybe not: I see in the influxdb log a 401 post request just before the Executed Flux query line:

Apr 22 23:32:33 rpi influxd-systemd-start.sh[531345]: [httpd] - - [22/Apr/2022:23:32:33 +0100] "POST /api/v2/query HTTP/1.1 " 401 55 "-" "Go-http-client/1.1" 1a95fbee-c28c-11ec-8138-dca63259d0a1 280

Hope this helps, as mean() seems to be working with influxQL but influxQL isn’t supported by e.g. the recent influx python lib thus we can’t use the full functionality this way.

EDIT1: Just found this issue in the flux repo. There is also a comment which suggests a workaround (can’t post a third link as new user, and I didn’t test it yet). Still it should be possible to use mean() on the long run

EDIT2: For me updating to Version 2.x solved the issue