https://discord.gg/botpress logo
autonomous node code execution error - results is ...
# 🤝help
s
Error during code execution: Cannot read properties of undefined (reading \'results\' From the logs:
Copy code
14:36:51
error
node:q_and_a_bot
autonomous-node
Error during code execution
Error during code execution
{ type: 'code_execution_exception',
  position: [ 3, 0 ],
  message: 'Cannot read properties of undefined (reading \'results\')',
  stackTrace: '  001 | // The user suspects an IP address is blocked, and I have search results related to blocking and whitelisting IP addresses. I should provide the user with the relevant information from the search results.
  002 | const results = (this.results as any[]) || [];
> 003 | if (results.length > 0) {
p
Could you provide more context for this error like the conversation it occurs in?
s
p
Do you have a searchResults variable? If so, what value is assigned to it?
s
I havent created that variable explicitly. This seems like its botpress code or code the agent is generating.
p
Have you given specific instructions to the AN in terms of the format of its answer?
s
yes, there are some instructions regarding response style. the problem is also intermittent which is challenging.
p
I would recommend trying to change those instructions to see if being more precise can solve your issue.
s
I removed nearly all instructions and Im still getting variable undefined errors. Reduced Instructions: > ## Identity > You are an AI help bot, named {{bot.name}}, that is knowledgeable on CIMcloud's platform. Your goal is to help a CIMcloud user by answering their questions in a professional, accurate, efficient, friendly and secure manner. The "CIMcloud Platform Overview" Help Center article has a high-level overview of the CIMcloud platform. > > ## Scope > - Focus exclusively on providing assistance with the CIMcloud platform. The error is very similar but a little different wording anv variable name: > Error during code execution > { type: 'code_execution_exception', > position: [ 3, 0 ], > message: 'searchResults is not defined', > stackTrace: ' 001 | // An error occurred because searchResults was not properly passed. I will correct the code and try again. > 002 | yield An error occurred while processing the search results. I will try again. > 003 | return { action: \'think\', searchResults: (searchResults as any) } > ^^^^^^^^^^ > ', > started_at: 1747863158587 } > {"scope":"autonomous-node","workflowId":"node:q_and_a_bot","nodeId":"node:q_and_a_bot"} https://cdn.discordapp.com/attachments/1374819591087456276/1374863565705445536/image.png?ex=682f98f9&is=682e4779&hm=ae302e41efd106943c50a32a5ee4d2feacf23ea39d58a515967fa7cfb1eb0fb7& https://cdn.discordapp.com/attachments/1374819591087456276/1374863565961433258/image.png?ex=682f98f9&is=682e4779&hm=57df05a15bb1999fcdec418a60707d141e764b5ff666e14daa81f31cae1c6b1f&
p
Could you try to route the questions to a query kKB card in a standard node and then print the answer with a text card instead of using the AN to answer questions?
s
@prehistoric-airplane-85682 Yes, I can try that. Are you suggesting that as a long-term solution or just as a troubleshooting step? Thx
p
Well generally, it is easier to control the query knowledge base card within an autonomous node than it is to get the search KB in an AN to work fully 100% of the time because the AN creates its own code. If you find it a suitable solution, I would implement it for real.
6 Views