Panic error on task with date

Hi,

when I try to add the task

import “date”
option task = { name: “test”, every: 1h, offset: 0h, concurrency: 1, retry: 3}
from(bucket: “b1”) |> range(start: date.truncate(t: -1mo, unit: 1mo)) |> to(bucket: “b2”)

I get the following error:

Error: A panic has occurred: /api/v2/tasks: interface conversion: interface {} is nil, not execute.ExecutionDependencies.

What am I doing wrong? If I use date.truncate(t: now(), unit: 1mo) instead of date.truncate(t: -1mo, unit: 1mo), the task gets accepted.

I’m using Influxdb 2.0.2 and I use the command

influx task create --org my-org -

to create the task.

Thank you in advance for your help!

Hello @Milo,
Welcome!
I think you have to pass a timestamp not a duration (-1mo) into the truncate function.
Try using subduration() to generate the timestamp first in a variable and then passing in the variable.

Hello Anaisdg,

thanks a lot for your suggestion, it worked!

Hi everyone!

I’ve stumbled upon this issue which was plaguing some of my tasks as well :sweat_smile:

I’ve found, though, that according to the documentation, the time.truncate should accept: “… an absolute time, relative duration, or integer”.

Doesn’t it mean that it should work without the experimental.subDuration? in fact, it does work from chronograf explore query panel.

BR,
Pedro