litellm - ✅(Solved) Fix [Bug]: I've already set litellm_settings: drop_params: true, but I'm still getting this error: [] is too short - 'tools' [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
BerriAI/litellm#24378Fetched 2026-04-08 01:18:07
View on GitHub
Comments
0
Participants
1
Timeline
5
Reactions
0
Author
Participants
Timeline (top)
labeled ×3cross-referenced ×1referenced ×1

Error Message

02:38:14 - LiteLLM Proxy:ERROR: common_request_processing.py:1121 - litellm.proxy.proxy_server._handle_llm_api_exception(): Exception occured - litellm.BadRequestError: OpenAIException - [] is too short - 'tools'. Received Model Group=qwen3.5-plus Traceback (most recent call last): openai.BadRequestError: Error code: 400 - {'error': {'code': None, 'message': "[] is too short - 'tools'", 'param': None, 'type': 'invalid_request_error'}, 'request_id': 'fd5d55d4-aba7-9f71-bc83-d96cd561c5dd'} During handling of the above exception, another exception occurred: Traceback (most recent call last): litellm.llms.openai.common_utils.OpenAIError: Error code: 400 - {'error': {'code': None, 'message': "[] is too short - 'tools'", 'param': None, 'type': 'invalid_request_error'}, 'request_id': 'fd5d55d4-aba7-9f71-bc83-d96cd561c5dd'} During handling of the above exception, another exception occurred: Traceback (most recent call last):

Fix Action

Fixed

PR fix notes

PR #24391: fix(utils): drop empty tools list when drop_params=True

Description (problem / solution / changelog)

Description

When drop_params: true is set, an empty tools=[] was still forwarded to the provider, causing validation errors such as:

"[] is too short"

This happened because tools=[] differs from the default tools=None, so it passed the non_default_params filter and was included in the request body.

Fix

In get_optional_params(), after non_default_params is built, add a check: if drop_params=True and tools is an empty list, remove it — consistent with the intent of drop_params: silently strip parameters that would cause the provider call to fail.

if (drop_params is True or litellm.drop_params is True) and non_default_params.get("tools") == []:
    non_default_params.pop("tools", None)

Testing

Added two unit tests in tests/test_litellm/test_utils.py:

  • test_drop_params_drops_empty_tools_list – empty tools=[] is dropped
  • test_drop_params_keeps_non_empty_tools_list – non-empty tools are preserved

Fixes #24378

Changed files

  • litellm/utils.py (modified, +11/-0)
  • tests/test_litellm/test_utils.py (modified, +46/-0)
RAW_BUFFERClick to expand / collapse

Check for existing issues

  • I have searched the existing issues and checked that my issue is not a duplicate.

What happened?

02:38:14 - LiteLLM Proxy:ERROR: common_request_processing.py:1121 - litellm.proxy.proxy_server._handle_llm_api_exception(): Exception occured - litellm.BadRequestError: OpenAIException - [] is too short - 'tools'. Received Model Group=qwen3.5-plus Available Model Group Fallbacks=None Traceback (most recent call last): File "/usr/lib/python3.13/site-packages/litellm/llms/openai/openai.py", line 1106, in async_streaming headers, response = await self.make_openai_chat_completion_request( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...<4 lines>... ) ^ File "/usr/lib/python3.13/site-packages/litellm/litellm_core_utils/logging_utils.py", line 297, in async_wrapper result = await func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.13/site-packages/litellm/llms/openai/openai.py", line 460, in make_openai_chat_completion_request raise e File "/usr/lib/python3.13/site-packages/litellm/llms/openai/openai.py", line 437, in make_openai_chat_completion_request await openai_aclient.chat.completions.with_raw_response.create( **data, timeout=timeout ) File "/usr/lib/python3.13/site-packages/openai/_legacy_response.py", line 381, in wrapped return cast(LegacyAPIResponse[R], await func(*args, **kwargs)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.13/site-packages/openai/resources/chat/completions/completions.py", line 2678, in create return await self._post( ^^^^^^^^^^^^^^^^^ ...<49 lines>... ) ^ File "/usr/lib/python3.13/site-packages/openai/_base_client.py", line 1794, in post return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.13/site-packages/openai/_base_client.py", line 1594, in request raise self._make_status_error_from_response(err.response) from None openai.BadRequestError: Error code: 400 - {'error': {'code': None, 'message': "[] is too short - 'tools'", 'param': None, 'type': 'invalid_request_error'}, 'request_id': 'fd5d55d4-aba7-9f71-bc83-d96cd561c5dd'}

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/python3.13/site-packages/litellm/main.py", line 612, in acompletion response = await init_response ^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.13/site-packages/litellm/llms/openai/openai.py", line 1156, in async_streaming raise OpenAIError( ...<4 lines>... ) litellm.llms.openai.common_utils.OpenAIError: Error code: 400 - {'error': {'code': None, 'message': "[] is too short - 'tools'", 'param': None, 'type': 'invalid_request_error'}, 'request_id': 'fd5d55d4-aba7-9f71-bc83-d96cd561c5dd'}

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/python3.13/site-packages/litellm/proxy/proxy_server.py", line 6240, in chat_completion result = await base_llm_response_processor.base_process_llm_request( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...<16 lines>... ) ^ File "/usr/lib/python3.13/site-packages/litellm/proxy/common_request_processing.py", line 856, in base_process_llm_request responses = await llm_responses ^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.13/site-packages/litellm/router.py", line 1533, in acompletion raise e File "/usr/lib/python3.13/site-packages/litellm/router.py", line 1509, in acompletion response = await self.async_function_with_fallbacks(**kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.13/site-packages/litellm/router.py", line 5104, in async_function_with_fallbacks return await self.async_function_with_fallbacks_common_utils(

#------------------------------------------------------------# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...<8 lines>... ) ^

'The thing I wish you improved is...'

https://github.com/BerriAI/litellm/issues/new

#------------------------------------------------------------#

Thank you for using LiteLLM! - Krrish & Ishaan

Steps to Reproduce

  1. open openclaw
  2. /btw *******
  3. result /btw failed: 400 litellm.BadRequestError: OpenAIException - [] is too short - 'tools'.

Relevant log output

What part of LiteLLM is this about?

Proxy

What LiteLLM version are you on ?

1.81.14

Twitter / LinkedIn details

No response

extent analysis

Fix Plan

To resolve the BadRequestError: OpenAIException - [] is too short - 'tools' issue, we need to ensure that the tools parameter is properly populated before making the OpenAI API request.

Here are the steps to fix the issue:

  • Check the tools parameter in the make_openai_chat_completion_request function and ensure it is not empty.
  • Modify the code to handle cases where tools might be empty or null.
  • Add error handling to catch and log any exceptions that occur during the API request.

Example code changes:

# In openai.py
def make_openai_chat_completion_request(self, **data):
    # Check if tools is empty
    if 'tools' in data and not data['tools']:
        raise ValueError("Tools cannot be empty")
    
    # ... rest of the function remains the same ...

# In common_request_processing.py
def base_process_llm_request(self, **kwargs):
    try:
        # ... make the API request ...
    except openai.BadRequestError as e:
        # Log the error and return a meaningful error message
        logging.error(f"Error making OpenAI API request: {e}")
        return {"error": str(e)}

Verification

To verify that the fix worked, follow these steps:

  • Repeat the steps to reproduce the issue.
  • Check the API request logs to ensure that the tools parameter is properly populated.
  • Verify that the error message is no longer returned and the API request is successful.

Extra Tips

  • Ensure that the tools parameter is properly validated and sanitized before making the API request.
  • Consider adding additional error handling and logging to catch and diagnose any issues that may occur during the API request.
  • Review the OpenAI API documentation to ensure that the tools parameter is being used correctly and that any required parameters are being passed.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING