Skip to content

[Fix] Fix for null tool call error#70

Merged
vipul-mittal merged 2 commits intomainfrom
scratch/llm_node_bug_fix
Dec 8, 2025
Merged

[Fix] Fix for null tool call error#70
vipul-mittal merged 2 commits intomainfrom
scratch/llm_node_bug_fix

Conversation

@Sidharthenee333
Copy link
Collaborator

@Sidharthenee333 Sidharthenee333 commented Dec 5, 2025

🐞 Bug Fix

📋 Summary

This PR fixes a bug in the inject_history_multiturn function in the llm_node that caused crashes when processing assistant messages without tool calls in multi-turn conversations.

Issue:

When an assistant response in chat history didn't contain tool calls (empty list []), the code attempted to convert the empty list to LangChain tool calls, causing a ValueError: Expected 'function' key in OpenAI tool call error in the
convert_openai_to_langchain_toolcall function.

Fix:

Added validation checks to ensure tool_calls_data contains items before attempting conversion:

🔧 Impacted Components

  • 🧠 llm_node.inject_history_multiturn — method now correctly handles assistant messages without tool calls

🧪 How to Test

  1. Run an end-to-end web/desktop agent eval task using any claude model with chat history injection enabled
  2. Note than in the output json file for any record even though there is a null tool call during any retry the subsequent retries have valid tool call and do not have an server errors.

📸 Screenshots

N/A

✅ Checklist

  • Lint fixes and unit testing done
  • End to end task testing
  • Documentation updated

Notes

N/A

@Sidharthenee333 Sidharthenee333 requested a review from a team as a code owner December 5, 2025 06:01
@Sidharthenee333 Sidharthenee333 changed the title Fixed bug in llm_node to add tool_call in assistant_message only when tool_calls are present [Fix] Fix for null tool call error Dec 5, 2025
@Sidharthenee333 Sidharthenee333 added the bug Something isn't working label Dec 5, 2025
Copy link
Collaborator

@psriramsnc psriramsnc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀

@vipul-mittal vipul-mittal merged commit 907c2e5 into main Dec 8, 2025
3 checks passed
@vipul-mittal vipul-mittal deleted the scratch/llm_node_bug_fix branch December 8, 2025 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants