ERROR: Invalid expression under ‘Could not find parameter “undefined”’

Describe the problem/error/question

OpenAI module reports error message saying it cannot access the variable from the extract HTML step. The output says the parameter is undefined however the execution history always shows a valid string for the variable. It seems to only occur if the gmail polling module finds more than one email.

What is the error message (if any)?

ERROR: Invalid expression under ‘Could not find parameter “undefined”’

The expression uses data in the node ‘Extract HTML’ but there is more than one matching item in that node

NodeApiError: Invalid expression
    at RoutingNode.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/RoutingNode.js:114:23)
    at Workflow.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Workflow.js:707:23)
    at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:652:53

Please share your workflow

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

Share the output returned by the last node

Information on your n8n setup

n8n cloud

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

Hey @rp2,

Welcome to the community :tada:

Can you share the output of the HTML Extract node as JSON so I can give it a test?

1 Like

Thanks Jon, here is the JSON from extract HTML for a failed run, i have redacted any sensitive information.

[
  {
    "text": "Zillow Rentals Inquiry New Contact REDACTED says:\"I'd like to schedule a viewing for REDACTED NY 19, US. Please contact me with more information!\"Income and time frameCredit score REDACTEDYearly income$REDACTEDLease length13 months5REDACTED REDACTED Your listingFOR RENT$1,600 bedrooms, 1.0 bathrooms310 REDACTED See all listing detailsZillow, Inc.1301 Second Avenue, Floor 36Seattle, WA 98101© 2006-2023Privacy policy",
    "links": [  
      "https://zillow.com",
    "https://zillow.com",
    "https://zillow.com",
    "https://zillow.com",
    "https://zillow.com"
    ],
    "images": [  "https://zillow.com",
    "https://zillow.com",
    "https://zillow.com",
    "https://zillow.com",
    "https://zillow.com"
    ]
  },
  {
    "text": "Zillow Rentals Inquiry New ContactREDACTED  says:\"Hello, I would like to schedule to view the apartament.\"Income and time frameCredit scoreREDACTED Lease length18 monthsPetsOtherREDACTED  Your listingFOR RENT$1,600 bedrooms, 1.0 bathrooms310REDACTED See all listing detailsZillow, Inc.1301 Second Avenue, Floor 36Seattle, WA 98101© 2006-2023Privacy policy",
    "links": [
      "https://zillow.com",
      "https://zillow.com",
      "https://zillow.com",
      "https://zillow.com",
      "https://zillow.com"
    ],
    "images": [
      "https://zillow.com",
      "https://zillow.com",
      "https://zillow.com",
      "https://zillow.com",
      "https://zillow.com"
    ]
  },
  {
    "text": "Zillow Rentals Inquiry New ContactREDACTED says:\"I'd like to schedule a viewing for REDACTED . Please contact me with more information!\"Income and time frameCredit score580 to 619Yearly income$17500Lease length13 monthsREDACTED  Your listingFOR RENT$REDACTED  bedrooms, 1.0 bathroomsREDACTED See all listing detailsZillow, Inc.1301 Second Avenue, Floor 36Seattle, WA 98101© 2006-2023Privacy policy",
    "links": [  "https://zillow.com",
    "https://zillow.com",
    "https://zillow.com",
    "https://zillow.com",
    "https://zillow.com"
    ],
    "images": [  "https://zillow.com",
    "https://zillow.com",
    "https://zillow.com",
    "https://zillow.com",
    "https://zillow.com"
    ]
  }
]

Hey @rp2,

Which node do you see the error in is it the Google Sheets node or the OpenAI node?

Its the openAI node in the content section the full expression used is below.

Create a list of exactly 6 items from the reference message below. Don't include labels in your answer. Parse out and capitalize as ";" separated values in this exact order: client first name,client last name,client email address without spaces, # of baths,apartment price,property address without city and state. Please provide the email address without any additional text or characters before or after it. Remove quotation marks from your response.  The reference message is here: {{ $('Extract HTML').item.json.text }}

Hey @rp2,

That is interesting, I noticed the Sheets node uses pretty much the same expression. When you run your workflow how many items are there normally going into each of the nodes?

Yes it does seem strange, it only ever fails if more than one item goes down that path.
The max number of items I have seen in the logs is 4.

Hi @Jon, any suggestions for how to fix this error?

Hey @rp2,

Sorry for the delay, We shut over the weekends :slight_smile:

I can’t think of anything at the moment it would be great to have an example of this we can run so the output of the google sheets nodes as well for testing or a smaller test workflow that reproduces the same issue.

Could it be that the Read Sheet node is outputting more than the amount of items coming out of the Extract HTML node?

What happens if you move the OpenAI node to earlier in the workflow as it doesn’t seem to be needed where it is so could happen after the Append Sheet node.

Hi Jon, no worries hope you had a good weekend!

The read sheet module is only ever outputting one node - its finding the row based on UUID generated earlier. I have added the “Return First Match” option, however that hasnt made any difference.

I moved the openAI module earlier, that module ran without error, however now a later module is getting the same error.

ERROR: Invalid expression under ‘JSON’

The expression uses data in the node ‘**Set Zillow Fields**’ but there is more than one matching item in that node
ExpressionError: Invalid expression
    at createExpressionError (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/WorkflowDataProxy.js:465:20)
    at getPairedItem (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/WorkflowDataProxy.js:550:31)
    at pairedItemMethod (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/WorkflowDataProxy.js:734:40)
    at Object.get (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/WorkflowDataProxy.js:737:40)
    at Proxy.eval (eval at getFunction (/usr/local/lib/node_modules/n8n/node_modules/@n8n/tournament/dist/index.js:24:22), <anonymous>:9:69)
    at Proxy.eval (eval at getFunction (/usr/local/lib/node_modules/n8n/node_modules/@n8n/tournament/dist/index.js:24:22), <anonymous>:16:7)
    at Tournament.execute (/usr/local/lib/node_modules/n8n/node_modules/@n8n/tournament/dist/index.js:33:19)
    at evaluateExpression (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/ExpressionEvaluatorProxy.js:110:16)
    at Expression.renderExpression (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Expression.js:219:70)
    at Expression.resolveSimpleParameterValue (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Expression.js:197:34)
    at Expression.getParameterValue (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Expression.js:281:25)
    at getNodeParameter (/usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/NodeExecuteFunctions.js:1420:42)
    at Object.getNodeParameter (/usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/NodeExecuteFunctions.js:1902:24)
    at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/HttpRequest/V3/HttpRequestV3.node.js:991:44)
    at Workflow.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Workflow.js:670:19)
    at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:652:53

What kind of output would you need for more testing?

Thanks

Hey @rp2,

Looking at that next error it is mentioning a node that isn’t in the example you have shared. Can you share the full workflow?

Hi @Jon the workflow is too long to paste in the message, can I share it in another way?

Hey @rp2,

That is always a worry, Are you able to export it as a file and share it that way?

Hi @Jon yeah I have the JSON file but I can only attach images here?

Hey @rp2,

What about in a DM or something like a GitHub gist?

Hi @Jon - here is a gist with the full workflow JSON N8N workflow · GitHub

Hi @Jon have you been able to take a look at the gist?

Hey @rp2,

I didn’t, I took a bit off time off but I am back now.

The workflow itself looks to be ok, It will take a bit of time to properly reverse what you are trying to do to test it but wich http request is giving the new error?

Have you also tried using the set node with the normal output rather than json to see if that helps?

Hi @Jon,

I have added a set node prior to openAI using the same syntax that was in the openAI module

{{ $('Extract HTML').item.json.text }}

Now I am referencing the set Node instead in openAI & it seems to have stopped the error.

I tried adding the set node before the branch & it failed, seemed to only work if it was after the switch.

Cant quite understand why this would fix the error, but it seems to be working.

I will monitor & see whether there are any errors over the next couple of days.

Thanks

1 Like

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