IF node never works

Describe the problem/error/question

No matter what I try in IF node with expression or fixed value I get:
The expression evaluated to a falsy value: a.ok(nodeExists)*


What is the error message (if any)?

The expression evaluated to a falsy value: a.ok(nodeExists)*

Please share your workflow

{
“nodes”: [
{
“parameters”: {},
“type”: “n8n-nodes-base.manualTrigger”,
“typeVersion”: 1,
“position”: [
0,
0
],
“id”: “f8d30d4b-0ee9-444b-8319-e631b5767b29”,
“name”: “When clicking ‘Test workflow’”
},
{
“parameters”: {
“authentication”: “appToken”,
“resource”: “deal”,
“operation”: “search”,
“returnAll”: true,
“filterGroupsUi”: {
“filterGroupsValues”: [
{
“filtersUi”: {
“filterValues”: [
{
“propertyName”: “dealstage”,
“value”: “1002773094”
}
]
}
}
]
},
“additionalFields”: {
“properties”: [
“description”,
“dealstage”,
“dealname”
]
}
},
“type”: “n8n-nodes-base.hubspot”,
“typeVersion”: 2.1,
“position”: [
160,
0
],
“id”: “a1b6bea8-71a9-4e94-a8d4-f3bb6e15839b”,
“name”: “HubSpot”,
“credentials”: {
“hubspotAppToken”: {
“id”: “W2ShDxaYeG2Fijfm”,
“name”: “HubSpot account”
}
}
},
{
“parameters”: {
“authentication”: “appToken”,
“resource”: “deal”,
“operation”: “get”,
“dealId”: {
“__rl”: true,
“value”: “={{ $json.id }}”,
“mode”: “id”
},
“filters”: {}
},
“type”: “n8n-nodes-base.hubspot”,
“typeVersion”: 2.1,
“position”: [
380,
0
],
“id”: “35dda681-1d3d-48a5-8d6b-93e92195df4e”,
“name”: “HubSpot1”,
“credentials”: {
“hubspotAppToken”: {
“id”: “W2ShDxaYeG2Fijfm”,
“name”: “HubSpot account”
}
}
},
{
“parameters”: {
“conditions”: {
“options”: {
“caseSensitive”: true,
“leftValue”: “”,
“typeValidation”: “strict”,
“version”: 2
},
“conditions”: [
{
“id”: “52778065-7e93-462e-b06b-d68a96c4e7e1”,
“leftValue”: “=30002667402”,
“rightValue”: “0”,
“operator”: {
“type”: “string”,
“operation”: “contains”
}
}
],
“combinator”: “and”
},
“options”: {}
},
“type”: “n8n-nodes-base.if”,
“typeVersion”: 2.2,
“position”: [
600,
0
],
“id”: “e8b13ca9-f307-4bcb-ad1e-c8e13edf0585”,
“name”: “If”
}
],
“connections”: {
“When clicking ‘Test workflow’”: {
“main”: [
[
{
“node”: “HubSpot”,
“type”: “main”,
“index”: 0
}
]
]
},
“HubSpot”: {
“main”: [
[
{
“node”: “HubSpot1”,
“type”: “main”,
“index”: 0
}
]
]
},
“HubSpot1”: {
“main”: [
[
{
“node”: “If”,
“type”: “main”,
“index”: 0
}
]
]
},
“If”: {
“main”: [

]
}
},
“pinData”: {},
“meta”: {
“templateCredsSetupCompleted”: true,
“instanceId”: “f673d6c1d48993627572c2b58f95c2707373a791d4c5a619191cd151c547fc0c”
}
}

Share the output returned by the last node

Information on your n8n setup

  • **n8n version: 1.82.3
  • **Database (default: SQLite): postgres
  • **Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: Ubuntu LTS
1 Like

I’m not exactly sure what you’re trying to test. It’s possible that the element [0] isn’t always present, so there might be cases where it can’t be checked. If you’re only trying to check if a list is empty, you can check if its length is equal to 0 or greater than 0. Then, of course, you’d look at $json.associations.associatedCompanyIds.

1 Like

[An upgrade from the reply by @Franz ]

The better version is: before to check if associatedCompanyIds has length > 0 (like sayed by Franz) you check if associatedCompanyIds exists (you need to use AND operator).

However the Franz’s solution is correct if you know that associatedCompanyIds exists always.

M.

1 Like

SOLVED

After saving the workflow and the reloading the page everything worked smoothly.

4 Likes

I’ve been getting The expression evaluated to a falsy value: a.ok(nodeExists) a lot in recent days on a self-hosted instance of n8n (Version 1.82.2)

Flows that work, just stop.

Saving and reloading seems to work for me as well in some cases. For larger flows, I’m actually having to duplicate the flow or copy parts to another new flow and then paste back in. Issue goes away.

Each time it goes away, I am testing with the data that initially created the error.

I’m now getting this on a very simple flow. Every time I add a node and try to run it I get The expression evaluated to a falsy value: a.ok(nodeExists)

It’s resolved if I save and reload, but maybe a bug was introduced in the last update? I’m self-hosted as well, but version 1.83.2

Same issue here, it happens randomly, even with very simple workflows.
Only way to solve is to save the workflow and reload the page.
Also running version 1.83.2 self-hosted.

I’m seeing this too, selfhosted same version

I’m experiencing something similar on self-hosted version 1.82.3, specifically with the Google Calendar node.

First, I get the following error:

“Cannot read properties of undefined (reading ‘disabled’)”

Then, shortly after, I get this message:

“Expression evaluated to false: a.ok(from)”

Note: Saving and reloading the page did not resolve the issue for me.

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