Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Anthropic code 400, program crash #12

Open
ogyr opened this issue Jan 11, 2025 · 2 comments
Open

Anthropic code 400, program crash #12

ogyr opened this issue Jan 11, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@ogyr
Copy link

ogyr commented Jan 11, 2025

catch the error or program crashes

miniconda3/lib/python3.12/site-packages/anthropic/_base_client.py", line 1633, in _request
raise self._make_status_error_from_response(err.response) from None
anthropic.BadRequestError: Error code: 400 - {'type': 'error', 'error': {'type': 'invalid_request_error', 'message': 'messages.36: all messages must have non-empty content except for the optional final assistant message'}}

@ogyr
Copy link
Author

ogyr commented Jan 11, 2025

call stack

File "/Users//WebPro/freeact/./run.py", line 21, in main
await stream_conversation(agent, console=Console(), skill_sources=skill_sources)
File "/Users//WebPro/freeact/freeact/cli/utils.py", line 65, in stream_conversation
await stream_turn(agent_turn, console, show_token_usage)
File "/Users//WebPro/freeact/freeact/cli/utils.py", line 77, in stream_turn
async for s in turn.stream():
File "/Users//WebPro/freeact/freeact/model/claude/model.py", line 68, in stream
async for elem in self._iter:
File "/Users//WebPro/freeact/freeact/model/claude/retry.py", line 80, in retry
raise err
File "/Users//WebPro/freeact/freeact/model/claude/retry.py", line 62, in retry
async for elem in stream_func():
File "/Users//WebPro/freeact/freeact/model/claude/model.py", line 227, in _stream
async with self._client.messages.stream(

@krasserm
Copy link
Member

Good catch, this occurs when submitting an empty query. Will be fixed in the next release. Thanks for reporting!

@krasserm krasserm added the bug Something isn't working label Jan 11, 2025
@krasserm krasserm assigned krasserm and unassigned krasserm Jan 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants