--- Logging error in Loguru Handler #1 ---
Record was: {'elapsed': datetime.timedelta(seconds=244, microseconds=54641), 'exception': None, 'extra': {'sid': '0f588b82-9b17-4f5a-a3cb-e6d1d565f8c4', 'step_no': 1, 'error_type': 'APIStatusError', 'error': APIStatusError('Error code: 400 - {\'error\': {\'message\': "an assistant message with \'tool_calls\' must be followed by tool messages responding to each \'tool_call_id\'. The following tool_call_ids did not have response messages: Shell:58", \'type\': \'invalid_request_error\'}}'), 'request_id': None}, 'file': (name='kimisoul.py', path='/Users/mymac/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/kimi_cli/soul/kimisoul.py'), 'function': '_agent_loop', 'level': (name='ERROR', no=40, icon='❌'), 'line': 741, 'message': 'Agent step 1 failed: APIStatusError: Error code: 400 - {\'error\': {\'message\': "an assistant message with \'tool_calls\' must be followed by tool messages responding to each \'tool_call_id\'. The following tool_call_ids did not have response messages: Shell:58", \'type\': \'invalid_request_error\'}}', 'module': 'kimisoul', 'name': 'kimi_cli.soul.kimisoul', 'process': (id=49448, name='MainProcess'), 'thread': (id=8316559552, name='MainThread'), 'time': datetime(2026, 4, 21, 20, 29, 38, 222120, tzinfo=datetime.timezone(datetime.timedelta(seconds=28800), 'CST'))}
Traceback (most recent call last):
File "/Users/mymac/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/kosong/chat_provider/kimi.py", line 165, in generate
response = await self.client.chat.completions.create(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...<6 lines>...
)
^
File "/Users/mymac/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/openai/resources/chat/completions/completions.py", line 2678, in create
return await self._post(
^^^^^^^^^^^^^^^^^
...<49 lines>...
)
^
File "/Users/mymac/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/openai/_base_client.py", line 1797, in post
return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mymac/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/openai/_base_client.py", line 1597, in request
raise self._make_status_error_from_response(err.response) from None
openai.BadRequestError: Error code: 400 - {'error': {'message': "an assistant message with 'tool_calls' must be followed by tool messages responding to each 'tool_call_id'. The following tool_call_ids did not have response messages: Shell:58", 'type': 'invalid_request_error'}}
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/mymac/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/kimi_cli/soul/kimisoul.py", line 735, in _agent_loop
step_outcome = await self._step()
^^^^^^^^^^^^^^^^^^
File "/Users/mymac/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/kimi_cli/soul/kimisoul.py", line 870, in _step
result = await _kosong_step_with_retry()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mymac/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/tenacity/asyncio/__init__.py", line 189, in async_wrapped
return await copy(fn, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mymac/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/tenacity/asyncio/__init__.py", line 111, in __call__
do = await self.iter(retry_state=retry_state)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mymac/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/tenacity/asyncio/__init__.py", line 153, in iter
result = await action(retry_state)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mymac/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/tenacity/_utils.py", line 99, in inner
return call(*args, **kwargs)
File "/Users/mymac/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/tenacity/__init__.py", line 400, in <lambda>
self._add_action_func(lambda rs: rs.outcome.result())
~~~~~~~~~~~~~~~~~^^
File "/opt/homebrew/Cellar/python@3.13/3.13.12/Frameworks/Python.framework/Versions/3.13/lib/python3.13/concurrent/futures/_base.py", line 449, in result
return self.__get_result()
~~~~~~~~~~~~~~~~~^^
File "/opt/homebrew/Cellar/python@3.13/3.13.12/Frameworks/Python.framework/Versions/3.13/lib/python3.13/concurrent/futures/_base.py", line 401, in __get_result
raise self._exception
File "/Users/mymac/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/tenacity/asyncio/__init__.py", line 114, in __call__
result = await fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mymac/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/kimi_cli/soul/kimisoul.py", line 863, in _kosong_step_with_retry
return await self._run_with_connection_recovery(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...<3 lines>...
)
^
File "/Users/mymac/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/kimi_cli/soul/kimisoul.py", line 1085, in _run_with_connection_recovery
return await operation()
^^^^^^^^^^^^^^^^^
File "/Users/mymac/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/kimi_cli/soul/kimisoul.py", line 846, in _run_step_once
return await kosong.step(
^^^^^^^^^^^^^^^^^^
...<6 lines>...
)
^
File "/Users/mymac/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/kosong/__init__.py", line 158, in step
result = await generate(
^^^^^^^^^^^^^^^
...<6 lines>...
)
^
File "/Users/mymac/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/kosong/_generate.py", line 53, in generate
stream = await chat_provider.generate(system_prompt, tools, history)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mymac/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/kosong/chat_provider/kimi.py", line 175, in generate
raise convert_error(e) from e
kosong.chat_provider.APIStatusError: Error code: 400 - {'error': {'message': "an assistant message with 'tool_calls' must be followed by tool messages responding to each 'tool_call_id'. The following tool_call_ids did not have response messages: Shell:58", 'type': 'invalid_request_error'}}
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/mymac/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/loguru/_handler.py", line 206, in emit
self._sink.write(str_record)
~~~~~~~~~~~~~~~~^^^^^^^^^^^^
File "/Users/mymac/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/loguru/_file_sink.py", line 206, in write
self._file.write(message)
~~~~~~~~~~~~~~~~^^^^^^^^^
OSError: [Errno 28] No space left on device
--- End of logging error ---
--- Logging error in Loguru Handler #1 ---
Record was: {'elapsed': datetime.timedelta(seconds=244, microseconds=111813), 'exception': (type=<class 'kosong.chat_provider.APIStatusError'>, value=APIStatusError('Error code: 400 - {\'error\': {\'message\': "an assistant message with \'tool_calls\' must be followed by tool messages responding to each \'tool_call_id\'. The following tool_call_ids did not have response messages: Shell:58", \'type\': \'invalid_request_error\'}}'), traceback=<traceback object at 0x11c073400>), 'extra': {'sid': ''}, 'file': (name='__init__.py', path='/Users/mymac/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/kimi_cli/ui/shell/__init__.py'), 'function': 'run_soul_command', 'level': (name='ERROR', no=40, icon='❌'), 'line': 882, 'message': 'LLM provider error:', 'module': '__init__', 'name': 'kimi_cli.ui.shell', 'process': (id=49448, name='MainProcess'), 'thread': (id=8316559552, name='MainThread'), 'time': datetime(2026, 4, 21, 20, 29, 38, 279292, tzinfo=datetime.timezone(datetime.timedelta(seconds=28800), 'CST'))}
Traceback (most recent call last):
File "/Users/mymac/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/kosong/chat_provider/kimi.py", line 165, in generate
response = await self.client.chat.completions.create(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...<6 lines>...
)
^
File "/Users/mymac/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/openai/resources/chat/completions/completions.py", line 2678, in create
return await self._post(
^^^^^^^^^^^^^^^^^
...<49 lines>...
)
^
File "/Users/mymac/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/openai/_base_client.py", line 1797, in post
return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mymac/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/openai/_base_client.py", line 1597, in request
raise self._make_status_error_from_response(err.response) from None
openai.BadRequestError: Error code: 400 - {'error': {'message': "an assistant message with 'tool_calls' must be followed by tool messages responding to each 'tool_call_id'. The following tool_call_ids did not have response messages: Shell:58", 'type': 'invalid_request_error'}}
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/mymac/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/kimi_cli/ui/shell/__init__.py", line 780, in run_soul_command
await run_soul(
...<23 lines>...
)
File "/Users/mymac/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/kimi_cli/soul/__init__.py", line 231, in run_soul
soul_task.result() # this will raise if any exception was raised in the run task
~~~~~~~~~~~~~~~~^^
File "/Users/mymac/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/kimi_cli/soul/kimisoul.py", line 537, in run
await self._turn(user_message)
File "/Users/mymac/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/kimi_cli/soul/kimisoul.py", line 600, in _turn
return await self._agent_loop()
^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mymac/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/kimi_cli/soul/kimisoul.py", line 735, in _agent_loop
step_outcome = await self._step()
^^^^^^^^^^^^^^^^^^
File "/Users/mymac/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/kimi_cli/soul/kimisoul.py", line 870, in _step
result = await _kosong_step_with_retry()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mymac/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/tenacity/asyncio/__init__.py", line 189, in async_wrapped
return await copy(fn, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mymac/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/tenacity/asyncio/__init__.py", line 111, in __call__
do = await self.iter(retry_state=retry_state)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mymac/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/tenacity/asyncio/__init__.py", line 153, in iter
result = await action(retry_state)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mymac/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/tenacity/_utils.py", line 99, in inner
return call(*args, **kwargs)
File "/Users/mymac/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/tenacity/__init__.py", line 400, in <lambda>
self._add_action_func(lambda rs: rs.outcome.result())
~~~~~~~~~~~~~~~~~^^
File "/opt/homebrew/Cellar/python@3.13/3.13.12/Frameworks/Python.framework/Versions/3.13/lib/python3.13/concurrent/futures/_base.py", line 449, in result
return self.__get_result()
~~~~~~~~~~~~~~~~~^^
File "/opt/homebrew/Cellar/python@3.13/3.13.12/Frameworks/Python.framework/Versions/3.13/lib/python3.13/concurrent/futures/_base.py", line 401, in __get_result
raise self._exception
File "/Users/mymac/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/tenacity/asyncio/__init__.py", line 114, in __call__
result = await fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mymac/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/kimi_cli/soul/kimisoul.py", line 863, in _kosong_step_with_retry
return await self._run_with_connection_recovery(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...<3 lines>...
)
^
File "/Users/mymac/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/kimi_cli/soul/kimisoul.py", line 1085, in _run_with_connection_recovery
return await operation()
^^^^^^^^^^^^^^^^^
File "/Users/mymac/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/kimi_cli/soul/kimisoul.py", line 846, in _run_step_once
return await kosong.step(
^^^^^^^^^^^^^^^^^^
...<6 lines>...
)
^
File "/Users/mymac/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/kosong/__init__.py", line 158, in step
result = await generate(
^^^^^^^^^^^^^^^
...<6 lines>...
)
^
File "/Users/mymac/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/kosong/_generate.py", line 53, in generate
stream = await chat_provider.generate(system_prompt, tools, history)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mymac/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/kosong/chat_provider/kimi.py", line 175, in generate
raise convert_error(e) from e
kosong.chat_provider.APIStatusError: Error code: 400 - {'error': {'message': "an assistant message with 'tool_calls' must be followed by tool messages responding to each 'tool_call_id'. The following tool_call_ids did not have response messages: Shell:58", 'type': 'invalid_request_error'}}
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/mymac/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/loguru/_handler.py", line 206, in emit
self._sink.write(str_record)
~~~~~~~~~~~~~~~~^^^^^^^^^^^^
File "/Users/mymac/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/loguru/_file_sink.py", line 206, in write
self._file.write(message)
~~~~~~~~~~~~~~~~^^^^^^^^^
OSError: [Errno 28] No space left on device
What version of Kimi Code CLI is running?
1.37.0
Which open platform/subscription were you using?
kimi-code
Which model were you using?
Kimi-k2.6
What platform is your computer?
Darwin 24.6.0 arm64 arm
What issue are you seeing?
What steps can reproduce the bug?
i'm not sure
What is the expected behavior?
the tool_call should success
Additional information
No response