Before submitting your bug report
Relevant environment info
- OS:
- Continue version:
- IDE version:
- Model:
- config:
OR link to agent in Continue hub:
Description
Bug Report: Malformed Message After Tool Request Cancellation
Summary
When canceling/denying a tool request in Continue, the follow-up message sent to the LLM has a malformed structure where the system message is not at the beginning of the conversation history. This causes a 400 Bad Request error from the LLM provider (via aqueduct proxy).
Error Details
Error: 400 aqueduct.BadRequestError: OpenAIException - Error code: 400 -
{'error': {'message': 'System message must be at the beginning.',
'type': 'BadRequestError', 'param': None, 'code': 400}}.
Received Model Group=qwen-3.5-397b
Steps to Reproduce
- Continue attempts to execute a tool (e.g., running a bash command like
sage selection/baselines/graph_operations.sage)
- User denies/cancels the tool request
- Continue sends a follow-up message to the LLM
- The LLM provider returns a 400 error indicating "System message must be at the beginning"
Expected Behavior
After canceling a tool request, Continue should:
- Properly format the conversation history with the system message at the beginning
- Send a valid message structure to the LLM
- Gracefully handle the cancellation and allow the user to continue the conversation
Actual Behavior
- The message structure is malformed
- System message is not positioned at the beginning of the conversation array
- The LLM provider rejects the request with a 400 error
- The conversation is interrupted and cannot continue
Environment
- Continue Extension: (version unknown)
- LLM Provider: qwen-3.5-397b (via aqueduct proxy)
- Proxy Layer: aqueduct
- Platform: darwin (macOS)
- Date: 2026-07-09
Additional Context
This appears to be an issue with how Continue constructs the conversation history message array after a tool cancellation event. The system message role should always be the first element in the messages array sent to OpenAI-compatible APIs, but after tool cancellation, this ordering seems to be violated.
Suggested Fix Areas
- Review message formatting logic in tool cancellation handlers
- Ensure system message is always positioned at
messages[0] after any conversation state change
- Add validation before sending requests to catch malformed message structures
Workaround
Currently, the only workaround is to restart the Continue chat session after this error occurs.
To reproduce
- make a request that runs a tool call
- cancel the tool call
Log output
Before submitting your bug report
Relevant environment info
Description
Bug Report: Malformed Message After Tool Request Cancellation
Summary
When canceling/denying a tool request in Continue, the follow-up message sent to the LLM has a malformed structure where the system message is not at the beginning of the conversation history. This causes a 400 Bad Request error from the LLM provider (via aqueduct proxy).
Error Details
Steps to Reproduce
sage selection/baselines/graph_operations.sage)Expected Behavior
After canceling a tool request, Continue should:
Actual Behavior
Environment
Additional Context
This appears to be an issue with how Continue constructs the conversation history message array after a tool cancellation event. The system message role should always be the first element in the messages array sent to OpenAI-compatible APIs, but after tool cancellation, this ordering seems to be violated.
Suggested Fix Areas
messages[0]after any conversation state changeWorkaround
Currently, the only workaround is to restart the Continue chat session after this error occurs.
To reproduce
Log output