agent-zero icon indicating copy to clipboard operation
agent-zero copied to clipboard

BUG minimax agent zero version 2.2

Open gianvitoferrara opened this issue 4 months ago • 2 comments

[Bug]: Minimax provider throws BadRequestError (2013) invalid_prompt - tool result's tool id not found

Description

When using LiteLLM with the MiniMax provider (https://api.minimax.io/v1/responses), a BadRequestError is raised during a chat turn involving Tool/Function Calling.

The API returns a 400 Bad Request with the error code 2013 (invalid_prompt), stating that the tool result's tool ID cannot be found. This usually happens because the provider cannot correctly link the tool response to the previous tool call payload formatted by LiteLLM.

Expected Behavior

LiteLLM should correctly map and forward the tool calls history and tool responses to the MiniMax OpenAI-compatible endpoint without triggering an invalid_prompt error.

Actual Behavior / Logs

litellm.exceptions.BadRequestError: litellm.BadRequestError: OpenAIException - {"error":{"message":"invalid params, tool result's tool id(call_function_z1pbgy47368b_1) not found (2013)","code":"invalid_prompt"}}

litellm.exceptions.BadRequestError: litellm.BadRequestError: OpenAIException - {"error":{"message":"invalid params, tool result's tool id(call_function_z1pbgy47368b_1) not found (2013)","code":"invalid_prompt"}}

Traceback (most recent call last):
  File "/opt/venv-a0/lib/python3.12/site-packages/litellm/llms/custom_httpx/llm_http_handler.py", line 2485, in async_response_api_handler
    response = await async_httpx_client.post(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv-a0/lib/python3.12/site-packages/litellm/litellm_core_utils/logging_utils.py", line 297, in async_wrapper
    result = await func(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv-a0/lib/python3.12/site-packages/litellm/llms/custom_httpx/http_handler.py", line 677, in post
    await _raise_masked_async_error(e, stream)
  File "/opt/venv-a0/lib/python3.12/site-packages/litellm/llms/custom_httpx/http_handler.py", line 461, in _raise_masked_async_error
    raise MaskedHTTPStatusError(e, message=_text, text=_text) from None
litellm.llms.custom_httpx.http_handler.MaskedHTTPStatusError: Client error '400 Bad Request' for url '[https://api.minimax.io/v1/responses](https://api.minimax.io/v1/responses)'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/venv-a0/lib/python3.12/site-packages/litellm/responses/main.py", line 559, in aresponses
    response = await init_response
               ^^^^^^^^^^^^^^^^^^^
  File "/opt/venv-a0/lib/python3.12/site-packages/litellm/llms/custom_httpx/llm_http_handler.py", line 2528, in async_response_api_handler
    raise self._handle_error(
          ^^^^^^^^^^^^^^^^^^^
  File "/opt/venv-a0/lib/python3.12/site-packages/litellm/llms/custom_httpx/llm_http_handler.py", line 5252, in _handle_error
    raise provider_config.get_error_class(
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv-a0/lib/python3.12/site-packages/litellm/llms/base_llm/responses/transformation.py", line 214, in get_error_class
    raise BaseLLMException(
litellm.llms.base_llm.chat.transformation.BaseLLMException: {"error":{"message":"invalid params, tool result's tool id(call_function_z1pbgy47368b_1) not found (2013)","code":"invalid_prompt"}}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/a0/helpers/extension.py", line 176, in _run_async
    data["result"] = await data["result"]
                     ^^^^^^^^^^^^^^^^^^^^
  File "/a0/agent.py", line 645, in handle_exception
    raise exception # exception handling is done by extensions
    ^^^^^^^^^^^^^^^
  File "/a0/agent.py", line 485, in monologue
    llm_result = await self.call_chat_model_turn(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/a0/helpers/extension.py", line 183, in _run_async
    result = _process_result(data)
             ^^^^^^^^^^^^^^^^^^^^^
  File "/a0/helpers/extension.py", line 143, in _process_result
    raise exc
  File "/a0/helpers/extension.py", line 176, in _run_async
    data["result"] = await data["result"]
                     ^^^^^^^^^^^^^^^^^^^^
  File "/a0/agent.py", line 973, in call_chat_model_turn
    llm_result = await call_data["model"].unified_turn(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/a0/models.py", line 702, in unified_turn
    async for parsed in transport.astream():
  File "/a0/helpers/litellm_transport.py", line 317, in astream
    iterator = await aresponses(**request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv-a0/lib/python3.12/site-packages/litellm/utils.py", line 2100, in wrapper_async
    raise e
  File "/opt/venv-a0/lib/python3.12/site-packages/litellm/utils.py", line 1899, in wrapper_async
    result = await original_function(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv-a0/lib/python3.12/site-packages/litellm/responses/main.py", line 581, in aresponses
    raise litellm.exception_type(
          ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv-a0/lib/python3.12/site-packages/litellm/litellm_core_utils/exception_mapping_utils.py", line 2466, in exception_type
    raise e
  File "/opt/venv-a0/lib/python3.12/site-packages/litellm/litellm_core_utils/exception_mapping_utils.py", line 543, in exception_type
    raise BadRequestError(

gianvitoferrara avatar Jul 04 '26 00:07 gianvitoferrara

Yep same issue, please fix., can basically not use minimax properly now.

templarx avatar Jul 04 '26 15:07 templarx

Closing due to inactivity of 90 days.

github-actions[bot] avatar Oct 03 '26 03:10 github-actions[bot]