Skip to content

Fix: Properly populate AssistantMessage error field#506

Merged
ashwin-ant merged 1 commit intoanthropics:mainfrom
ben-complement:fix/populate-AssistantMessage-errors
Feb 3, 2026
Merged

Fix: Properly populate AssistantMessage error field#506
ashwin-ant merged 1 commit intoanthropics:mainfrom
ben-complement:fix/populate-AssistantMessage-errors

Conversation

@ben-complement
Copy link
Contributor

Summary

Fixes #505

  • Fix AssistantMessage.error field not being populated due to incorrect data path
  • The error field is at the top level of the response (data["error"]), not nested inside data["message"]["error"]
  • Add test coverage for error scenarios (authentication_failed, unknown, rate_limit)

Test plan

  • Added unit tests for assistant messages without errors
  • Run python -m pytest tests/test_message_parser.py to verify all tests pass

🤖 Generated with Claude Code

@ben-complement
Copy link
Contributor Author

Bump: Users still can't use the error field to programmatically handle error responses. This surfaced again as a result of the outages this morning

@ashwin-ant ashwin-ant merged commit 94eaf75 into anthropics:main Feb 3, 2026
16 checks passed
@ashwin-ant
Copy link
Collaborator

Sorry, didn't click merge 😳

@ben-complement
Copy link
Contributor Author

Sorry, didn't click merge 😳

Np, appreciate it!

@ben-complement ben-complement deleted the fix/populate-AssistantMessage-errors branch February 3, 2026 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] AssistantMessage error field not being properly populated

2 participants