Can't get output data from nodes preceding node with no output data

Doing my own workflow I faced a problem with accessing output data from nodes preceding the node which doesn’t provide output data.

In my case, no output occurs in MongoDB find node when the searched document doesn’t exist yet. In such case, I want to continue processing (set “Always Output Data” in node settings) and then I want to use some data preceding the MongoDB node, but unfortunately the error occurs:

Missing pairedItem data (node ‘MongoDB’ probably didn’t supply it)
ExpressionError: Can’t get data for expression
    at createExpressionError (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/WorkflowDataProxy.js:453:20)
    at getPairedItem (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/WorkflowDataProxy.js:506:27)
    at pairedItemMethod (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/WorkflowDataProxy.js:714:40)
    at Object.get (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/WorkflowDataProxy.js:717:40)
    at Proxy.eval (eval at _create (/usr/local/lib/node_modules/n8n/node_modules/@n8n_io/riot-tmpl/dist/tmpl.js:377:14), <anonymous>:3:62)
    at Object._tmpl (/usr/local/lib/node_modules/n8n/node_modules/@n8n_io/riot-tmpl/dist/tmpl.js:335:60)
    at Expression.renderExpression (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Expression.js:205:25)
    at Expression.resolveSimpleParameterValue (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Expression.js:184:34)
    at resolveParameterValue (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Expression.js:270:25)
    at Expression.getParameterValue (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Expression.js:287:31)
    at resolveParameterValue (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Expression.js:268:29)
    at /usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Expression.js:276:61
    at Array.map (<anonymous>)
    at Expression.getParameterValue (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Expression.js:276:47)
    at getNodeParameter (/usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/NodeExecuteFunctions.js:1227:42)
    at Object.getNodeParameter (/usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/NodeExecuteFunctions.js:1448:24)
    at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Set/Set.node.js:173:18)
    at Workflow.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Workflow.js:652:51)
    at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:596:68
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

Example workflow

Here are the synthetic workflow which transparently represents the problem:

Last node issues:

  • Can’t get data for expression (To fetch the data from other nodes that this expression needs, more information is needed from the node ‘MongoDBMore info)
  • Execution Error.

n8n setup

  • n8n version: 0.230.3
  • Database: SQLite
  • n8n EXECUTIONS_PROCESS setting: own, main
  • Running n8n via: Docker
  • Operating system: MacOS

Welcome to the community @nixikanius!

Yes, that is sadly a bug we also discovered a few days ago. There is already a PR to fix it which should be merged and released soon:

What you can do in the meantime is to use a different syntax. As the most time just one item gets passed through anyway can you directly target the first one (and in this case only one) with for example:

$('Set').first().json

I hope that is helpful!

1 Like

@jan thank you very much for fast response. The workaround you suggested works as needed!

Great to hear. Have fun!

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