# Error while defining location parameter for aggregateWindow

**URL:** <https://community.influxdata.com/t/error-while-defining-location-parameter-for-aggregatewindow/24433>\
**Category:** Fluxlang\
**Tags:** flux\
**Created:** [March 28, 2022, 9:02pm UTC](https://community.influxdata.com/t/error-while-defining-location-parameter-for-aggregatewindow/24433 "2022-03-28T21:02:18Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![mutigozel](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/mutigozel/32/9792_2.png) [@mutigozel](https://community.influxdata.com/u/mutigozel)\
**Post date:** [March 28, 2022, 9:02pm UTC](https://community.influxdata.com/t/error-while-defining-location-parameter-for-aggregatewindow/24433/1 "2022-03-28T21:02:18Z")

</div>

Hi all,

When I try to set location parameter in aggregateWindow parameters as below:

```auto
  |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false, location: "UTC")

```

I get an error like:

```auto
 error @5:6-5:91: expected {zone:string, offset:duration} but found string (argument location)

```

Can you help me with that?

Thank you,

Muti

---

<div class="post-metadata">

**Author:** ![Tiki10](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/tiki10/32/9735_2.png) [@Tiki10](https://community.influxdata.com/u/Tiki10)\
**Post date:** [March 29, 2022, 4:17am UTC](https://community.influxdata.com/t/error-while-defining-location-parameter-for-aggregatewindow/24433/2 "2022-03-29T04:17:44Z")

</div>

Hello,

I think you can’t use “mean” for a string.  
Try “distinct” instead.  
Did you tried Chronograf ?

Regards,

---

<div class="post-metadata">

**Author:** ![alespour](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/alespour/32/5907_2.png) [@alespour](https://community.influxdata.com/u/alespour)\
**Post date:** [March 29, 2022, 10:17am UTC](https://community.influxdata.com/t/error-while-defining-location-parameter-for-aggregatewindow/24433/3 "2022-03-29T10:17:46Z")

</div>

Location parameter is of record type, with zone and offset fields, not just zone name string. Please have a look at [timezone](https://docs.influxdata.com/flux/v0.x/stdlib/timezone/) package. This should work:

```plaintext
import "timezone"
...
|> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false, location: timezone.utc)

```

---

<div class="post-metadata">

**Author:** ![mutigozel](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/mutigozel/32/9792_2.png) [@mutigozel](https://community.influxdata.com/u/mutigozel)\
**Post date:** [March 29, 2022, 3:18pm UTC](https://community.influxdata.com/t/error-while-defining-location-parameter-for-aggregatewindow/24433/4 "2022-03-29T15:18:19Z")

</div>

I think something wrong with my setup. When I execute the query below:

```auto
import "timezone"

timezone.location(name: "America/Los_Angeles")

```

I get an error like:

```auto
 error calling function "location" @3:1-3:47: unknown time zone America/Los_Angeles

```

Any kind of help is much appreciated!

Thank you,

Muti

---

<div class="post-metadata">

**Author:** ![mutigozel](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/mutigozel/32/9792_2.png) [@mutigozel](https://community.influxdata.com/u/mutigozel)\
**Post date:** [March 29, 2022, 4:37pm UTC](https://community.influxdata.com/t/error-while-defining-location-parameter-for-aggregatewindow/24433/5 "2022-03-29T16:37:28Z")

</div>

I extended my example to the below one, and it still gives an error. Can you please suggest a solution?

Query: I want to aggregate my data which represented in utc time for days in America/Los\_Angeles timezone. aggregateWindow 's location parameter is throwing an error when added to the query.

```auto
import "array"
import "timezone"

// _time is utc - they have the Z suffix in the litteral
data = array.from(rows:[ 
    {_time: 2022-03-12T00:00:00Z, _value: 10}
  , {_time: 2022-03-12T06:00:00Z, _value: 20}
  , {_time: 2022-03-12T12:00:00Z, _value: 30}
  , {_time: 2022-03-12T18:00:00Z, _value: 40}

  , {_time: 2022-03-13T00:00:00Z, _value: 100}
  , {_time: 2022-03-13T06:00:00Z, _value: 200}
  , {_time: 2022-03-13T12:00:00Z, _value: 300}
  , {_time: 2022-03-13T18:00:00Z, _value: 400}

  , {_time: 2022-03-14T00:00:00Z, _value: 1000}
  , {_time: 2022-03-14T06:00:00Z, _value: 2000}
  , {_time: 2022-03-14T12:00:00Z, _value: 3000}
  , {_time: 2022-03-14T18:00:00Z, _value: 4000} 
])
  |> range(start: 2022-03-12, stop: 2022-03-15)

// aggregate daily in "America/Los_Angeles" timezone
data
  |> range(start: 2022-03-11T00:00:00Z, stop: 2022-03-16T00:00:00Z)
  |> aggregateWindow( every: 1d
                    , fn:mean
                    , createEmpty: false
                    , location: timezone.location(name: "America/Los_Angeles")
                    )
  |> keep(columns: ["_time", "_value"])

```

error:

```auto
 error calling function "location" @30:33-30:79: unknown time zone America/Los_Angeles

```

---

<div class="post-metadata">

**Author:** ![alespour](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/alespour/32/5907_2.png) [@alespour](https://community.influxdata.com/u/alespour)\
**Post date:** [March 30, 2022, 8:31am UTC](https://community.influxdata.com/t/error-while-defining-location-parameter-for-aggregatewindow/24433/6 "2022-03-30T08:31:45Z")

</div>

It works for me with 2.1.1 docker image. It seems like your system is missing zone info files, at least the one `for America/Los_Angeles`.

---

<div class="post-metadata">

**Author:** ![mutigozel](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/mutigozel/32/9792_2.png) [@mutigozel](https://community.influxdata.com/u/mutigozel)\
**Post date:** [March 30, 2022, 4:50pm UTC](https://community.influxdata.com/t/error-while-defining-location-parameter-for-aggregatewindow/24433/7 "2022-03-30T16:50:37Z")

</div>

How can I fix this on a windows machine?

---

<div class="post-metadata">

**Author:** ![alespour](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/alespour/32/5907_2.png) [@alespour](https://community.influxdata.com/u/alespour)\
**Post date:** [March 31, 2022, 12:41pm UTC](https://community.influxdata.com/t/error-while-defining-location-parameter-for-aggregatewindow/24433/8 "2022-03-31T12:41:53Z")

</div>

Download Go’s [zoneinfo.zip](https://github.com/golang/go/raw/master/lib/time/zoneinfo.zip) and set environment variable ZONEINFO with absolute path of the file, like

`set ZONEINFO=C:\Data\zoneinfo.zip`  
`influxd run`

I’ve created issue [#23248](https://github.com/influxdata/influxdb/issues/23248). It, or similar issue, was reported before and fixed. But I just tested 2.1.1 on Win7 machine and reproduced the error.

---

<div class="post-metadata">

**Author:** ![CZvacko](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/czvacko/32/9764_2.png) [@CZvacko](https://community.influxdata.com/u/CZvacko)\
**Post date:** [June 25, 2026, 7:59am UTC](https://community.influxdata.com/t/error-while-defining-location-parameter-for-aggregatewindow/24433/9 "2026-06-25T07:59:23Z")

</div>

I tried it on Windows 11, and it doesn’t seem to work. Do I need to install Go on the operating system? I tried that, too, but without success.

---

<div class="post-metadata">

**Author:** ![cbowden](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/cbowden/32/20322_2.png) [@cbowden](https://community.influxdata.com/u/cbowden)\
**Post date:** [June 25, 2026, 9:17pm UTC](https://community.influxdata.com/t/error-while-defining-location-parameter-for-aggregatewindow/24433/10 "2026-06-25T21:17:06Z")

</div>

You don’t need to install Go, no.

Likely the issue is that you’ve set the environment variable incorrectly. If you downloaded `zoneinfo.zip` , make sure you provide the path to where the file actually is, with `set ZONEINFO=C:\your\file\path\zoneinfo.zip` - just copying the command as alespour provided wouldn’t work unless you moved the file into that specific directory.

---

<div class="post-metadata">

**Author:** ![CZvacko](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/czvacko/32/9764_2.png) [@CZvacko](https://community.influxdata.com/u/CZvacko)\
**Post date:** [June 27, 2026, 11:35am UTC](https://community.influxdata.com/t/error-while-defining-location-parameter-for-aggregatewindow/24433/11 "2026-06-27T11:35:56Z")

</div>

I found the issue. Originally, I set it in the NSSM/Environment variable like this:  
_set ZONEINFO=D:\Monitoring\InfluxDBv2\zoneinfo.zip_

But it must be just _ZONEINFO=D:\Monitoring\InfluxDBv2\zoneinfo.zip_  
Now it works 😀

 ![zoneinfo-ok](https://us1.discourse-cdn.com/flex023/uploads/influxdata/original/3X/2/d/2dc086afbc9f71db72c58a33c0dce936b9a552b0.jpeg)

---

<div class="post-metadata">

**Author:** ![cbowden](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/cbowden/32/20322_2.png) [@cbowden](https://community.influxdata.com/u/cbowden)\
**Post date:** [June 29, 2026, 11:30pm UTC](https://community.influxdata.com/t/error-while-defining-location-parameter-for-aggregatewindow/24433/12 "2026-06-29T23:30:27Z")

</div>

Ah, yeah, that’ll do it. In case anyone else comes across this thread, use `set` if you’re setting the environment variable via a terminal/command line interface. If you use a UI or are editing a file that stores environment variables, you can just specify the variable directly.
