Runtime Error: Index out of range [-1]

I’m trying to reference the Compose record ID in a query string, but when I get to the function step that executes the query I get this error message:

Could not execute automation: step 20 crashed: runtime error: index out of range [-1]

Here’s a screenshot of that step:

I know there’s an expression step in the middle that I don’t really need, but I was trying some different things, none of which worked. I know I’m able to pull the record.recordID field from the start step, but I’m not sure why this is causing problems. I’ve used similar structures with success.

When creating filters I suggest you first try it on a record list and then in a workflow step.
Remove the WHERE from the filter. You should never include it in a filter.