Handle Anthropic invalid_request_error in Duo Chat
Problem
Some requests to V2 Duo Chat encountered the exception invalid_request_error in Anthropic.
Error message: all messages must have non-empty content except for the optional final assistant message
See the comments below for more details.
This also could result in A1002.
Proposal
- Investigate why it happened.
- Fix the root cause.
Root cause
Chat history (persisted messages in Redis) are likely corrupted.
Workaround
Clean up the chat history by /reset or /clear.
Edited by Shinya Maeda