Negating clause gives "insufficient bindings"

I’m still a noob to this query language (been using Obsidian for a long time, so mapping over knowledge :slight_smile: )

I’m trying to filter out DONE tasks in a query.

         (task ?block #{"TODO" "DOING"})

works just fine, but:

         (not (task ?block #{"DONE"}))

Gives me “Insufficient bindings: none of #{?block} is bound”

Why does negating a clause suddenly lose bindings? What am I doing wrong here?

I’m assuming you use simple query syntax within an advanced query?
The simple query syntax is {{query (not (task DONE))}} according to the live query builder. And yes this gives an error as well! :joy:
Which is to say your syntax is technically correct, but Logseq is throwing an error for some reason :woman_shrugging:t4:

Use this advanced query syntax instead. It does work.

#+BEGIN_QUERY
{:title [:h3 "Tasks not done"]
 :query [:find (pull ?b [*])
  :where
   [?b :block/marker ?m]
   (not [(contains? #{"DONE"} ?m)])
 ]
}
#+END_QUERY
1 Like

Submitted bug report:

1 Like

Ah, thank you. Well, I guess it makes me feel better it’s a bug and not me :smile: