Contains does not work on arrays (workaround included))

I am trying to check wheter a task contains a certain itag

replace `` by ```:

``template
{{#let @t = {task where not done}}}
{{#each @t}}
{{contains(itags,"sleep")}}
{{/each}}
{{/let}}
``

But it seems contains() only work with pure strings and not any kind of arrays. I got this error message:
Error: contains(): str is not a string

so i have to use a temp variable that is rendered to get a string

(replace `` by ```):

#sleep

* [ ] this is a task 

``query
task select page,name,itags
``


``template
{{#let @t = {task where not done}}}
{{#if @t}}
| page | task | sleep|
|----------|----------|----------|
{{#each @t}}
{{#let @it = template([[Library/Core/Query/Page]], {"name": itags})}}
{{#if contains(@it,"sleep")}}
| [[{{ref}}|{{page}}]] |  {{name}} |  ✅|
{{else}}
| [[{{ref}}|{{page}}]] |  {{name}} |  |
{{/if}}
{{/let}}
{{/each}}
{{else}}
(no)
{{/if}}
{{/let}}
``

this renders to:

#sleep

* [ ] this is a task 

|page|name|itags|
|--|--|--|
|index|this is a task|task, sleep|
|other page|other task|task|


| page | task | sleep|
|----------|----------|----------|
| [[index@10|index]] |  this is a task |  ✅|
| [[other page@2|other page]] |  other task |  |

Is there a better way to get to the same result? Am I missing something here?