Final Response Returns Empty After Tool Call Failure
📋 Description
In a multi-step conversation flow, the final assistant response is returned as empty, even though the system executed a tool call and received a response.
This leads to a poor user experience where the UI shows no output after user input.
🔁 Steps to Reproduce Start a conversation with product suggestions. Ask to view a specific product (e.g., "Show the red saree"). Select an option (e.g., "second one saree"). System triggers a tool call (get_product_details). Tool returns an error (e.g., product not found). Observe the final assistant response. ❌ Actual Behavior The assistant makes a tool call successfully. Tool returns a response (Product not found). Final assistant message is empty ("").
Example logs: {"event":"message","message":{"message_id":"23928278-136a-44f7-b878-421ef7504e62","role":"user","content":[{"type":"text","text":"show the second one saree","annotations":[]}],"delta":false,"tools_calls":null,"reasoning":null,"timestamp":1774463263.593936,"metadata":{},"usages":null,"raw":null},"state":null,"data":null,"thread_id":"840fc097-d35e-468b-8a52-8d98849ddf2d","run_id":"d5c4b78a-2366-4786-9142-c66df4e81bfa","metadata":{"status":"invoking_graph","reason":"initial human message"},"timestamp":1774463080.35561} {"event":"message","message":{"message_id":"f83968f9-a237-4fcf-a1e6-d8f90bca9d19","role":"assistant","content":[{"type":"tool_call","id":"47e7a0e3-9379-4544-a1b0-6d64c0e5935c","name":"get_product_details","args":{"product_id":"1"},"tool_type":null}],"delta":true,"tools_calls":[{"id":"47e7a0e3-9379-4544-a1b0-6d64c0e5935c","function":{"name":"get_product_details","arguments":"{"product_id": "1"}"},"type":"function"}],"reasoning":"","timestamp":1774463265.999954,"metadata":{},"usages":null,"raw":null},"state":null,"data":null,"thread_id":"840fc097-d35e-468b-8a52-8d98849ddf2d","run_id":"d5c4b78a-2366-4786-9142-c66df4e81bfa","metadata":{"node":"MAIN","function_name":"MAIN"},"timestamp":1774463080.35561} {"event":"message","message":{"message_id":"5381399f-3f41-4e3c-ad3b-e075db3d5afb","role":"assistant","content":[{"type":"tool_call","id":"47e7a0e3-9379-4544-a1b0-6d64c0e5935c","name":"get_product_details","args":{"product_id":"1"},"tool_type":null}],"delta":false,"tools_calls":[{"id":"47e7a0e3-9379-4544-a1b0-6d64c0e5935c","function":{"name":"get_product_details","arguments":"{"product_id": "1"}"},"type":"function"}],"reasoning":"","timestamp":1774463266.001471,"metadata":{"function_name":"MAIN","provider":"google_genai","node_name":"MAIN","thread_id":"840fc097-d35e-468b-8a52-8d98849ddf2d"},"usages":null,"raw":null},"state":null,"data":null,"thread_id":"840fc097-d35e-468b-8a52-8d98849ddf2d","run_id":"d5c4b78a-2366-4786-9142-c66df4e81bfa","metadata":{"node":"MAIN","function_name":"MAIN"},"timestamp":1774463080.35561} {"event":"message","message":{"message_id":"b44d0f8d-2502-4702-8978-a2b26cb82af0","role":"tool","content":[{"type":"tool_result","call_id":"47e7a0e3-9379-4544-a1b0-6d64c0e5935c","output":[{"error":"Product 1 not found","product_id":"1"}],"is_error":false,"status":"completed"}],"delta":false,"tools_calls":null,"reasoning":null,"timestamp":1774463266.39155,"metadata":{"function_name":"get_product_details","function_argument":{"product_id":"1"},"tool_call_id":"47e7a0e3-9379-4544-a1b0-6d64c0e5935c"},"usages":null,"raw":null},"state":null,"data":{"status":"tool_invoked","tool_name":"get_product_details","args":{"product_id":"1"},"tool_call_id":"47e7a0e3-9379-4544-a1b0-6d64c0e5935c","node":"TOOL"},"thread_id":"840fc097-d35e-468b-8a52-8d98849ddf2d","run_id":"d5c4b78a-2366-4786-9142-c66df4e81bfa","metadata":null,"timestamp":1774463080.35561} {"event":"message","message":{"message_id":"72fcee62-d943-412e-a641-47f5e9a1880c","role":"assistant","content":[],"delta":true,"tools_calls":null,"reasoning":"","timestamp":1774463272.162953,"metadata":{},"usages":null,"raw":null},"state":null,"data":null,"thread_id":"840fc097-d35e-468b-8a52-8d98849ddf2d","run_id":"d5c4b78a-2366-4786-9142-c66df4e81bfa","metadata":{"node":"MAIN","function_name":"MAIN"},"timestamp":1774463080.35561} {"event":"message","message":{"message_id":"bade0627-05f8-4233-b80f-4d844ea603d0","role":"assistant","content":[],"delta":false,"tools_calls":null,"reasoning":"","timestamp":1774463272.164063,"metadata":{"function_name":"MAIN","provider":"google_genai","node_name":"MAIN","thread_id":"840fc097-d35e-468b-8a52-8d98849ddf2d"},"usages":null,"raw":null},"state":null,"data":null,"thread_id":"840fc097-d35e-468b-8a52-8d98849ddf2d","run_id":"d5c4b78a-2366-4786-9142-c66df4e81bfa","metadata":{"node":"MAIN","function_name":"MAIN"},"timestamp":1774463080.35561} {"event":"updates","message":null,"state":{"context":[{"message_id":"93bfeb00-851a-4217-bbcd-4e7f2e63a2c1","role":"user","content":[{"type":"text","text":"Hii","annotations":[]}],"delta":false,"tools_calls":null,"reasoning":null,"timestamp":1774463161.479721,"metadata":{},"usages":null,"raw":null},{"message_id":"a59be4de-b563-40fc-ae90-7c95a7c56c91","role":"assistant","content":[{"type":"text","text":"Hii! Here are some of our top-selling products:\n\n* Red Saree - a beautiful Silk Saree for ₹4000.00.\n* Purple magenta lehenga - a Bansari Silk lehenga, originally ₹3500.00, now ₹3000.00. It's a popular choice for weddings.\n* Cotton Saree - an Orange Cotton Saree, originally ₹2500.00, now ₹2000.00. Also great for weddings.\n* Red Saree - another lovely Bansari Silk Saree, originally ₹5500.00, now ₹5000.00.\n\nWould you like to explore any of these further, or are you looking for something specific?","annotations":[]}],"delta":false,"tools_calls":null,"reasoning":"","timestamp":1774463168.734736,"metadata":{"function_name":"MAIN","provider":"google_genai","node_name":"MAIN","thread_id":"840fc097-d35e-468b-8a52-8d98849ddf2d"},"usages":null,"raw":null},{"message_id":"0b919bf8-287d-4cf7-ae4a-eff92469d424","role":"user","content":[{"type":"text","text":"Show the red saree","annotations":[]}],"delta":false,"tools_calls":null,"reasoning":null,"timestamp":1774463209.672212,"metadata":{},"usages":null,"raw":null},{"message_id":"94fc6b19-ea96-413f-8519-a461614daa61","role":"assistant","content":[{"type":"text","text":"We have two red sarees that were top sellers:\n\n* Red Saree - a beautiful Silk Saree for ₹4000.00.\n* Red Saree - another lovely Bansari Silk Saree, originally ₹5500.00, now ₹5000.00.\n\nWhich one would you like to see?","annotations":[]}],"delta":false,"tools_calls":null,"reasoning":"","timestamp":1774463212.606556,"metadata":{"function_name":"MAIN","provider":"google_genai","node_name":"MAIN","thread_id":"840fc097-d35e-468b-8a52-8d98849ddf2d"},"usages":null,"raw":null},{"message_id":"7e4ffc80-5a4e-44d5-b201-69a49ecfe905","role":"user","content":[{"type":"text","text":"1st one","annotations":[]}],"delta":false,"tools_calls":null,"reasoning":null,"timestamp":1774463224.429143,"metadata":{},"usages":null,"raw":null},{"message_id":"da459521-b8e1-45db-8d90-c135fd97c69d","role":"assistant","content":[{"type":"text","text":"It looks like I couldn't find the first red silk saree for ₹4000.00 in our current catalog. My apologies for that!\n\nWould you like to see the other Red Saree - a Bansari Silk Saree, originally ₹5500.00, now ₹5000.00? Or perhaps I can show you some other options?","annotations":[]}],"delta":false,"tools_calls":null,"reasoning":"","timestamp":1774463229.698993,"metadata":{"function_name":"MAIN","provider":"google_genai","node_name":"MAIN","thread_id":"840fc097-d35e-468b-8a52-8d98849ddf2d"},"usages":null,"raw":null},{"message_id":"23928278-136a-44f7-b878-421ef7504e62","role":"user","content":[{"type":"text","text":"show the second one saree","annotations":[]}],"delta":false,"tools_calls":null,"reasoning":null,"timestamp":1774463263.593936,"metadata":{},"usages":null,"raw":null},{"message_id":"bade0627-05f8-4233-b80f-4d844ea603d0","role":"assistant","content":[],"delta":false,"tools_calls":null,"reasoning":"","timestamp":1774463272.164063,"metadata":{"function_name":"MAIN","provider":"google_genai","node_name":"MAIN","thread_id":"840fc097-d35e-468b-8a52-8d98849ddf2d"},"usages":null,"raw":null}],"context_summary":null,"execution_meta":{"current_node":"MAIN","step":4,"status":"completed","interrupted_node":null,"interrupt_reason":null,"interrupt_data":null,"thread_id":"840fc097-d35e-468b-8a52-8d98849ddf2d","stop_current_execution":"none","internal_data":{}}},"data":{"status":"graph_invoked","reason":"Graph execution finished","time_taken":9.444601058959961,"is_interrupted":false,"total_messages":8},"thread_id":"840fc097-d35e-468b-8a52-8d98849ddf2d","run_id":"d5c4b78a-2366-4786-9142-c66df4e81bfa","metadata":null,"timestamp":1774463080.35561}
✅ Expected Behavior The assistant should handle tool failures gracefully. A proper fallback message should be returned, such as: “Sorry, I couldn't find that product.” Or suggest alternatives. 📊 Impact Breaks conversational flow. Confuses users due to lack of feedback. Makes debugging difficult. 💡 Possible Cause Missing fallback handling after tool execution. Response generation step not triggered when tool returns an error. LLM output overwritten or not propagated after tool result. 🛠 Suggested Fix Ensure assistant always returns a non-empty response. Add fallback handling for tool errors.
Validate response before sending to user:
if not response: response = "Something went wrong. Please try again." 🧪 Additional Notes Happens specifically when tool returns error but is_error=false in tool result. Might be related to how tool outputs are parsed into final response.