paul-gauthier / aider

aider is AI pair programming in your terminal
https://aider.chat/
Apache License 2.0
19.83k stars 1.81k forks source link

Claude 3.5 Sonnet response parsing crashed in the middle of a response #775

Closed mikehearn closed 3 months ago

mikehearn commented 3 months ago

Issue


^^^ Expected `>>>>>>> REPLACE` not `=======
I apologize for the formatting error in my previous response. You're absolutely right, and I appreciate your reminder about the correct format for SEARCH/REPLACE blocks. Let me provide the corrected version:

scripts/create-maven-bundle.shell.kts
<source>kotlin
<<<<<<< SEARCH
import com.sun.org.apache.xpath.internal.Arg
import org.jetbrains.kotlin.org.apache.http.util.Args
import kotlin.system.exitProcess

// Parse command line arguments
val args = Args(
    "Unexpected error: litellm.InternalServerError: AnthropicException - litellm.APIConnectionError: Unable to parse response. Original response: event: error
Traceback (most recent call last):
  File "/Users/mike/bin/venv/lib/python3.11/site-packages/litellm/utils.py", line 8758, in chunk_creator
    response_obj = self.handle_anthropic_chunk(chunk)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mike/bin/venv/lib/python3.11/site-packages/litellm/utils.py", line 8000, in handle_anthropic_chunk
    raise ValueError(f"Unable to parse response. Original response: {str_line}")
ValueError: Unable to parse response. Original response: event: error
. Handle with `litellm.InternalServerError`.
Traceback (most recent call last):
  File "/Users/mike/bin/venv/lib/python3.11/site-packages/litellm/utils.py", line 8758, in chunk_creator
    response_obj = self.handle_anthropic_chunk(chunk)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mike/bin/venv/lib/python3.11/site-packages/litellm/utils.py", line 8000, in handle_anthropic_chunk
    raise ValueError(f"Unable to parse response. Original response: {str_line}")
ValueError: Unable to parse response. Original response: event: error

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/mike/bin/venv/lib/python3.11/site-packages/litellm/utils.py", line 9480, in __next__
    response: Optional[ModelResponse] = self.chunk_creator(chunk=chunk)
                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mike/bin/venv/lib/python3.11/site-packages/litellm/utils.py", line 9410, in chunk_creator
    raise exception_type(
          ^^^^^^^^^^^^^^^
  File "/Users/mike/bin/venv/lib/python3.11/site-packages/litellm/utils.py", line 7586, in exception_type
    raise e
  File "/Users/mike/bin/venv/lib/python3.11/site-packages/litellm/utils.py", line 7559, in exception_type
    raise APIConnectionError(
litellm.exceptions.APIConnectionError: litellm.APIConnectionError: Unable to parse response. Original response: event: error
Traceback (most recent call last):
  File "/Users/mike/bin/venv/lib/python3.11/site-packages/litellm/utils.py", line 8758, in chunk_creator
    response_obj = self.handle_anthropic_chunk(chunk)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mike/bin/venv/lib/python3.11/site-packages/litellm/utils.py", line 8000, in handle_anthropic_chunk
    raise ValueError(f"Unable to parse response. Original response: {str_line}")
ValueError: Unable to parse response. Original response: event: error

Version and model info

Aider v0.41.0 Models: claude-3-5-sonnet-20240620 with diff edit format, weak model claude-3-haiku-20240307 Git repo: .git with 2,044 files Warning: For large repos, consider using an .aiderignore file to ignore irrelevant files/dirs. Repo-map: using 1024 tokens

paul-gauthier commented 3 months ago

Thanks for filing this issue.

Looks like Anthropic's servers just returned a broken response?

paul-gauthier commented 3 months ago

I'm going to close this issue for now, but feel free to add a comment here and I will re-open or file a new issue any time.