Node cannot access data from previous node v1.11.2+

Describe the problem/error/question

Posting this here in follow up to: Unable to access content of a previous node from anything other than the immediate next node · Issue #7623 · n8n-io/n8n · GitHub

When processing batch items, the IF node throws the following error:

ERROR: Invalid expression under ‘Conditions > String’
The expression uses data in the node ‘Salesforce’ but there is more than one matching item in that node


What is the error message (if any)?

Please share your workflow

Share the output returned by the last node

Please check the video and then use the data below for the last two nodes


SELECT Id, Legacy_ID__c FROM Contact 
WHERE planet_CRM_Address_Processed__c = false AND Legacy_ID__c != null
    "attributes": {
      "type": "Contact",
      "url": "/services/data/v39.0/sobjects/Contact/0031v00003JcdMAAAZ"
    "Id": "0031v00003JcdMAAAZ",
    "Legacy_ID__c": "169193"
    "attributes": {
      "type": "Contact",
      "url": "/services/data/v39.0/sobjects/Contact/0031v00003JcdMBAAZ"
    "Id": "0031v00003JcdMBAAZ",
    "Legacy_ID__c": "169195"

for MySQL node:

FROM locator l
         INNER JOIN party p on l.party_id =
WHERE l.category = 'address'
  AND l.party_id = '{{ $('Salesforce1').item.json.Legacy_ID__c }}'
  AND l.is_default = 1
  AND l.real_locator_id IS NULL
  AND l.deleted_at IS NULL;
    "party_id": 169193,
    "type": "default",
    "id": 338058
    "party_id": 169195,
    "type": "default",
    "id": 890332

Information on your n8n setup

  • n8n version: 1.15.2
  • Database (default: SQLite): Postgres
  • n8n EXECUTIONS_PROCESS setting (default: own, main): queue
  • Running n8n via (Docker, npm, n8n cloud, desktop app): heroku
  • Operating system:

Hi @saal, I am sorry you’re having trouble. As suggested by Jon over on GitHub this is because you’re trying to access a linked item (formerly known as paired item) after running a custom query on your MySQL1 node.

n8n will not be able to produce a linked item for custom SQL queries since it won’t be able to analyze which result was generated by which input item here.

You could avoid this problem for example by using a legacy expression type like {{ $node['Salesforce1'].json.Legacy_ID__c }}

In this case n8n just assumes the first item on the current node corresponds to the first item of the Salesforce1 node. The second item on the current node corresponds to the second item of Salesforce1 etc.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.