ToolCallResultNotSubmittedRunError
langchain_core.chains.base.ToolCallResultNotSubmittedRunError
Stack trace
langchain_core.chains.base.ToolCallResultNotSubmittedRunError: Tool call result was not submitted during the run, causing execution to halt.
Why it happens
In function-calling chains, the framework expects the tool call result to be explicitly submitted back to the chain runner. If the tool call result is missing or not returned properly, the chain cannot continue and raises this error. This often happens when the tool function does not return the expected output or the chain logic does not handle the tool response correctly.
Detection
Monitor chain execution logs for missing tool call results and catch ToolCallResultNotSubmittedRunError exceptions to log the incomplete tool response before failure.
Causes & fixes
The tool function does not return any result or returns None
Ensure the tool function returns a valid result object or string that the chain expects.
The chain logic does not submit the tool call result back to the runner
Modify the chain or callback handler to explicitly submit the tool call result after execution.
Mismatch between expected tool output format and actual returned data
Align the tool output format with the chain's expected schema or parsing logic.
Code: broken vs fixed
from langchain_core.chains import Tool
def my_tool(input_text):
# Missing return statement causes no result submission
print(f'Processing: {input_text}')
# This will raise ToolCallResultNotSubmittedRunError
result = my_tool('test input') # error here
print(result) import os
from langchain_core.chains import Tool
os.environ['LANGCHAIN_API_KEY'] = os.environ.get('LANGCHAIN_API_KEY', '') # Use env var for keys
def my_tool(input_text):
# Return a valid result string to submit
return f'Processed: {input_text}'
result = my_tool('test input') # fixed: returns result
print(result) # prints 'Processed: test input' Workaround
Wrap the tool call in try/except ToolCallResultNotSubmittedRunError, and if caught, manually construct and submit a fallback result to allow the chain to continue.
Prevention
Design tool functions to always return a valid result and implement chain callbacks that verify and submit tool call results explicitly to avoid missing submissions.