continuedev / continuedev/continue

Malformed Message After Tool Request Cancellation

Open
#12,963 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area:tools kind:bug os:mac
Dominant language
TypeScript
Stars
36k
Forks
5.4k
PR merge metrics
No merged PRs in 30d

Description

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

  1. Continue attempts to execute a tool (e.g., running a bash command like sage selection/baselines/graph_operations.sage)
  2. User denies/cancels the tool request
  3. Continue sends a follow-up message to the LLM
  4. 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

  1. Review message formatting logic in tool cancellation handlers
  2. Ensure system message is always positioned at messages[0] after any conversation state change
  3. 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
  1. make a request that runs a tool call
  2. cancel the tool call
Log output

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.