https://discord.gg/botpress logo
Transition routes with empty text and crashes + ne...
# šŸ¤help
g
**OBJECTIVE**: After my API_Call workflow runs if results -> send workflow.wpPostsText in a message node. If no results -> route to autonomous node. It should never attempt to send an empty message. ACTUAL: When WP returns no results, workflow.wpPostsText ends up empty. Instead of routing to Autonomous, the flow still attempts to send a Message with empty text and the bot crashes with: Error: data/text must NOT have fewer than 1 characters. Also in the Router condition editor, I keep seeing a warning and highlighting of my second expression noting: the next expression will not be evaluated because the previous expression will always catch the event. What I have tried the last two days - Originally used an AI Transition (Text to categorize: {{event.preview}}, categories wp / answer) it sometimes chose wp even when no results, causing empty Message crash. - Switched to Router_2 IF/ELSE after API_Call (screenshot attached) to make routing deterministic. - Tried checking flags like workflow.wpFound and also tried checking for non-empty text (trim().length > 0). - Still seeing the ā€œnext expression will not be evaluatedā€ notice in the Router condition editor, and I’m still getting the empty Message crash in some cases. Ask / What I need help with - What is the correct/recommended way in Botpress Studio to prevent sending an empty Message? - Is there a best practice for a ā€œsafe messageā€ / fallback text in Message nodes? - Is the Router condition editor warning (ā€œnext expression will not be evaluatedā€) normal, or does it indicate the condition isn’t being evaluated correctly? - Why would the flow still transition to Message after ā€œno resultsā€ if Router_2 is set up IF/ELSE? https://cdn.discordapp.com/attachments/1461132662268756190/1461132663783030971/Screenshot_2026-01-14_143810.png?ex=697b3d95&is=6979ec15&hm=25050fa8d9382bd3166b819ecc0b64e8ed5ac106c36c4124a785f500ab40c28a&
w
Hi @great-australia-29330 Could you share screenshots of
if
expression and
else
expression ?
g
This is the first expressions text: workflow.wpFound == true && workflow.wpPostsText && workflow.wpPostsText.trim().length > 0 https://cdn.discordapp.com/attachments/1461132662268756190/1461377482010787952/image.png?ex=696a5556&is=696903d6&hm=f380a5f6a071b4917e2415f009181f57d413e04d0a4e8f2b6315ca9cacff1c31&
l
@white-nest-40686
w
You wrote the condition in the description field / AI generator code.
To insert conditions, you need to disable the AI (icon at the right) on that field.
g
Oh my gosh, thank you. I am a total newbie with botpress clearly. Thanksss!
w
Happy to help
g
If you can answer one more additional question I changed the condition properly and it still ignores the second condition https://cdn.discordapp.com/attachments/1461132662268756190/1461421417169162373/image.png?ex=696a7e41&is=69692cc1&hm=a1cb7a2201bbafafa9f0df65f027ca14822dd4d77a09ec7e2451dd3454902607&
w
In the Router 2 node, use the Log card before transitions to see the value of
workflow.wpFound
3 Views