Skip to content

Crash after large refactoring #1221

Closed
Closed
@efunneko

Description

@efunneko

Issue

I did asked for a reasonably large refactoring of some markdown files in which it removed two files, created a sub-directory and then created 4 files in that sub-directory. After the LLM response was complete, I got this stack dump and aider quit:

File "/home/github/chat/.venv/bin/aider", line 8, in <module>
    sys.exit(main())
  File "/home/github/chat/.venv/lib/python3.10/site-packages/aider/main.py", line 661, in main
    coder.run()
  File "/home/github/chat/.venv/lib/python3.10/site-packages/aider/coders/base_coder.py", line 725, in run
    self.run_one(user_message, preproc)
  File "/home/github/chat/.venv/lib/python3.10/site-packages/aider/coders/base_coder.py", line 768, in run_one
    list(self.send_message(message))
  File "/home/github/chat/.venv/lib/python3.10/site-packages/aider/coders/base_coder.py", line 1129, in send_message
    self.show_exhausted_error()
  File "/home/github/chat/.venv/lib/python3.10/site-packages/aider/coders/base_coder.py", line 1206, in show_exhausted_error
    input_tokens = self.main_model.token_count(self.format_messages())
  File "/home/github/chat/.venv/lib/python3.10/site-packages/aider/models.py", line 590, in token_count
    msgs = json.dumps(messages)
  File "/usr/lib/python3.10/json/__init__.py", line 231, in dumps
    return _default_encoder.encode(obj)
  File "/usr/lib/python3.10/json/encoder.py", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/lib/python3.10/json/encoder.py", line 257, in iterencode
    return _iterencode(o, 0)
  File "/usr/lib/python3.10/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type ChatChunks is not JSON serializable

I restarted and tried the same refactoring again and I got the same crash.

Version and model info

Aider v0.54.4
Model: Sonnet 3.5 accessed through an OpenAI API on a LiteLLM proxy

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingfixed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions