Skip to content

Claude Sonnet-4.6 LLM not working properly (assistant message prefill error) #570

@parthiv-middleware

Description

@parthiv-middleware

Description

When using Claude Sonnet-4.6 with Agno agents/teams, the request fails with a 400 error related to assistant message prefilling.

It appears that Claude Sonnet-4.6 no longer supports assistant message prefill and requires the conversation to end with a user message.

This behavior worked correctly when using previous models like Claude Sonnet-4.5.

Error Logs

ERROR Claude API error (status 400): Error code: 400 - {'type': 'error', 'error': {'type': 'invalid_request_error', 'message': 'This model does not support assistant message prefill. The conversation must end with a user message.'}, 'request_id': 'req_011CZ6ggheCNFP94eWsCFgfH'}

ERROR Non-retryable model provider error: Error code: 400 - {'type': 'error', 'error': {'type': 'invalid_request_error', 'message': 'This model does not support assistant message prefill. The conversation must end with a user message.'}, 'request_id': 'req_011CZ6ggheCNFP94eWsCFgfH'}

ERROR Error in Team run: Error code: 400 - {'type': 'error', 'error': {'type': 'invalid_request_error', 'message': 'This model does not support assistant message prefill. The conversation must end with a user message.'}, 'request_id': 'req_011CZ6ggheCNFP94eWsCFgfH'}

Steps to Reproduce

  1. Create an Agno agent or team.
  2. Configure the model as claude-sonnet-4-6.
  3. Run the agent.
  4. The request fails with a 400 error.

Expected Behavior

Claude Sonnet-4.6 should work with Agno agents/teams without throwing a 400 error.

Actual Behavior

Agent execution fails with an invalid_request_error related to assistant message prefill.

Environment

  • Framework: Agno (version 2.5.5)
  • Model: claude-sonnet-4-6
  • Provider: Anthropic API
  • OS: Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions