denglander
denglander2h ago

Condition step won't work correctly

I'm having a very frustrating issue with a condition step. In a previous step, I am setting a number of different variables. Here is an example from a run debug: "metadata": { "variables": { "candidate_1_city": "Brooklyn", "candidate_2_city": "Brooklyn", "candidate_3_city": "Brooklyn", "candidate_1_desired_schedule": "Part-time", "candidate_2_desired_schedule": "Open to any work schedule", "candidate_3_desired_schedule": "Per-Diem", "candidate_1_state": "NY", "candidate_2_state": "NY", "candidate_3_state": "NY", "candidate_1_languages": "English", "candidate_2_languages": "English", "candidate_3_languages": "English", "candidate_1_discipline": "Personal Care Aide (PCA)", "candidate_2_discipline": "Personal Care Aide (PCA)", "candidate_3_discipline": "Personal Care Aide (PCA)", "candidate_1_desired_shift": "Morning", "candidate_2_desired_shift": "Evening; Afternoon; Weekdays; Morning; Night", "candidate_3_desired_shift": "Morning; Afternoon; Evening; Night; Weekdays; Weekends", "candidate_1_care_setting": "Inpatient; Home Care", "candidate_2_care_setting": "Home Care; Inpatient", "candidate_3_care_setting": "Home Care; Skilled (nursing / assisted living)", "num_candidates": "3" } I have a condition step next which is looking to see if candidate_3_discipline is empty. I keep getting this error: { "time": 1756932611431, "type": "debug", "payload": { "ref": { "type": "node", "nodeID": "68b8a539d07704ebfbd586ba", "nodeType": "condition-v3", "diagramID": "64dbb6696a8fab0013dba194" }, "level": "warn", "message": "expression failed", "context": "Condition", "metadata": { "error": {} } } } I've tried doing this about 10 different ways with different variables but nothing is working.
1 Reply
Tico | Voiceflow Assistant
That "expression failed" warning is coming from the JavaScript expression inside the Condition step – the code can’t be parsed, so the step never evaluates to true / false and Voiceflow shows the error. A few things to double-check: 1️⃣ Make sure you write the variable name without curly-braces or quotes
// ✅ CORRECT – plain JS that returns a boolean
!candidate_3_discipline || candidate_3_discipline.trim() === ""

// ❌ Will throw – brackets are treated as part of the string
"{candidate_3_discipline}" === ""
// ✅ CORRECT – plain JS that returns a boolean
!candidate_3_discipline || candidate_3_discipline.trim() === ""

// ❌ Will throw – brackets are treated as part of the string
"{candidate_3_discipline}" === ""
2️⃣ The expression field must contain only a boolean expression – do not add a return or a semicolon at the end. 3️⃣ If you prefer the no-code option, switch the Condition to Business Logic → Builder and set: • Variable = candidate_3_discipline • Operator = is empty • Path = whatever you want to run when it’s empty Voiceflow will create the correct JS for you in the background. 4️⃣ If there are executions where candidate_3_discipline hasn’t been created yet, the expression above (!candidate_3_discipline) will still work – an undefined or empty string is treated as falsey. After fixing the expression / builder setup, run the Debugger again and the warning should disappear, with the flow taking the correct path. Docs: https://docs.voiceflow.com (→ Condition step → Expression / Builder sections)

Did you find this page helpful?