continuedev / continuedev/continue
Malformed Message After Tool Request Cancellation
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 36k
- Forks
- 5.4k
- PR merge metrics
- No merged PRs in 30d
Description
Before submitting your bug report
- I've tried finding an answer on the Continue docs site
- I'm not able to find an open issue that reports the same bug
- I've seen the troubleshooting guide on the Continue Docs
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the tool cancellation handlers and the conversation message-formatting logic described in the report, then reproduce the cancellation flow with a tool request. Verify the message array sent after cancellation and ensure the system message remains first; done means the follow-up request is accepted and the conversation can continue without restarting.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- ai, devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100