If block matches string literal, but not string expression

As we do not like people to be driven bonkers I try my best to help you!

You are having this issue because you are comparing the data of two nodes that have a different number of items.

Search Value:

  1. Item: { name: ‘foo’ '}

Test Data:

  1. Item: { name: ‘bar’ '}
  2. Item: { name: ‘foo’ '}

So in the IF-Node the following is happening because n8n automatically compares the items with the same index:

  1. Item: It compares “foo” with “bar” => does not match so false
  2. Item: It compares undefined with “foo” => does not match so false

Hope that helps!