None is not of type 'object'

When calling functions with no input arguments it gives this error

response =,
  File "/usr/local/lib/python3.9/site-packages/openai/_utils/", line 299, in wrapper
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/openai/resources/chat/", line 556, in create
    return self._post(
  File "/usr/local/lib/python3.9/site-packages/openai/", line 1055, in post
    return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
  File "/usr/local/lib/python3.9/site-packages/openai/", line 834, in request
    return self._request(
  File "/usr/local/lib/python3.9/site-packages/openai/", line 877, in _request
    raise self._make_status_error_from_response(err.response) from None
openai.OpenAIError: Error code: 400 - {'error': {'message': "None is not of type 'object' - 'messages.2.function_call'", 'type': 'invalid_request_error', 'param': None, 'code': None}}

This used to work before the recent updates.

An example of the function I try to call:

tools = [
      "type": "function",
      "function": {
          "name":  "escalate_to_manager",
          "description": "Contact the manager when there is nothing else that can be done",
          "parameters": {
              "type": "object",
              "properties": {},
              "required": [],

And I am calling the chat completion normally:

response =,

got the answer, you need to remove the function_call key if you are using tool_call

1 Like

I can’t post the link but go to github issues and you will see the same reported issue and a solution that worked for me.

Hey @farahats9 et al,

I was looking into this issue, but I’m not able to reproduce it. Are you able to confirm whether you are still seeing this issue?