Repository navigation
Erroneous “enum reference must resolve to a list” #3020
Description
Activity
- addedstate: needs triageWaiting to be triaged by a maintainer.Waiting to be triaged by a maintainer.
on Sep 7, 2026 From google AI, this suggestion, it seems correct so give it a try.
version: '3' vars: LIST_STR: { sh: printf '%s\n' aaa bbb ccc } LIST: '{{splitLines .LIST_STR}}' tasks: foo: requires: vars: - name: FOO enum: ref: LIST cmds: - echo "You chose {{.FOO}}"- addedstate: awaiting reviewWaiting for a maintainer to review.Waiting for a maintainer to review.
on Sep 7, 2026 $ task foo FOO=bar template: resolver:1: function "LIST" not definedI’m sorry but did you even try it?
Even with
ref: .LISTit goes back toenum reference ".LIST" must resolve to a list… I mean I know I’ve written a correct Taskfile, it’s just a bug I wanted to notify.I’m sorry but I’m tired of AI just hallucinating solutions… it just doesn’t work.
No, I did not try it. AI is going to be more responsive for figuring this out ... its unlikely that this is going to be a bug. Not impossible, but unlikely.
You might try to locate LIST var to the task. Is possible that it tries to resolve LIST_STR before the
shis evaluated, relocating would address that.See the documentation for examples (which I assume work), notice the location of the 'sh' variable (global) and
enumvariable (task).
https://taskfile.dev/docs/guide#using-variable-references-for-enum-valuesWhat do you mean by “AI is going to be more responsive for figuring this out”?
Also, this —taken from the docs (link you shared)— works:
version: '3' vars: AVAILABLE_SERVICES: sh: ls services/ tasks: deploy: requires: vars: - name: SERVICE enum: ref: .AVAILABLE_SERVICES | splitLines | compact cmds: - echo "Deploying {{.SERVICE}}"
$ mkdir services $ touch services/foo $ task deploy SERVICE=foo task: [deploy] echo "Deploying foo" Deploying foo $ task deploy SERVICE=bar task: Task "deploy" cancelled because it is missing required variables: - SERVICE has an invalid value : 'bar' (allowed values : [foo])I don’t see a meaningful difference from my example (which doesn’t work):
version: 3 vars: LIST_STR: sh: printf '%s\n' aaa bbb ccc tasks: foo: requires: vars: - name: FOO enum: ref: splitLines .LIST_STR
(By the way I am using
lsin my code;printfhere was to make line separation explicit)version: '3' vars: AVAILABLE_SERVICES: sh: ls services/ tasks: deploy: requires: vars: - name: SERVICE enum: - ref: .AVAILABLE_SERVICES | splitLines | compact + ref: .AVAILABLE_SERVICES | splitLines cmds: - echo "Deploying {{.SERVICE}}"This is enough to make the docs example fail (
enum reference ".AVAILABLE_SERVICES | splitLines" must resolve to a list). I’m sorry but I call this a bug.compactis just supposed to remove empty strings from the slice (https://sprig.taskfile.dev/lists.html#compact-mustcompact).@RemiBardon Please update your version of Task to the latest.
> task --version 3.52.0 > task -d ./tmp/3020 foo FOO=bar enum reference ".LIST" must resolve to a list
> task --version 3.53.1 > task -d ./tmp/3020 foo FOO=bar task: Task "foo" cancelled because it is missing required variables: - FOO has an invalid value : 'bar' (allowed values : [aaa bbb ccc])
Reacted by Rémi Bardon- removedstate: needs triageWaiting to be triaged by a maintainer.Waiting to be triaged by a maintainer.
on Sep 7, 2026 - removedstate: awaiting reviewWaiting for a maintainer to review.Waiting for a maintainer to review.
on Sep 7, 2026 Oh! That’s nice :) Hadn’t seen the fix being mentioned in the
3.53.1release (thought I had a recent-enough version)What do you mean by “AI is going to be more responsive for figuring this out”?
I mean, the AI has got spare time to help you. And its pretty good, even if you have to tell it "no, please try again, this time an example which actually works".
I have spent the whole day closing PR's submitted to the Task project which were written by AI which are poor quality.
Well you have my full support then because it must be awful 😔 Sorry for being triggered by you sending slop at me. In addition to wasting your time, all this slop you face ends up undermining human-to-human conversations… what a world.
Description
Given the example Taskfile, when I:
then I get:
It usually works in other places, I don’t get why it doesn’t work here.
My use case is: allowing a set of possible values based on the result of a
ls(i.e. “choosing a file”, more or less).Version
3.52.0
Operating system
macOS 15.7.7 (24G720)
Experiments Enabled
No response
Example Taskfile