Skip to content

found multiple "user" roles in a row' #20

@Linde7777

Description

@Linde7777

Describe the bug

Query: what is the weather of NY?

Error: Error code: 400 - {'message': 'messages: roles must alternate between "user" and "assistant", but found multiple "user" roles in a row'}

To Reproduce
Steps to reproduce the behavior:

  1. Clone this repo in linux
  2. run the client.py
  3. fix some import error like ModuleNotFoundError: No module named 'mcp.server.fastmcp' by import these module in client.py
  4. enter the query what is the weather of NY?

Expected behavior
The client should tell me the weather of NY

Logs

(mcp-client-python) root@1panel:~/plspace/mcp-client-python# uv run client.py /root/plspace/weather-server-python/weather.py 

Connected to server with tools: ['get_alerts', 'get_forecast']

MCP Client Started!
Type your queries or 'quit' to exit.

Query: what is the weather of NY?

Error: Error code: 400 - {'message': 'messages: roles must alternate between "user" and "assistant", but found multiple "user" roles in a row'}

Additional context
I use bedrock sdk with socks5 proxy

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions