Compaction does not work after changing models sometimes #4014

Closed
opened 2026-02-16 17:42:17 -05:00 by yindo · 2 comments
Owner

Originally created by @esau-morais on GitHub (Dec 30, 2025).

Originally assigned to: @rekram1-node on GitHub.

Description

Image

seems like when i change model to perform compaction-only sometimes it doesn't do anything and gets stuck in this state.

if i try to run again, returns an error:

messages.1: all messages must have non-empty content except for the optional final assistant message

Image

OpenCode version

1.0.218

Steps to reproduce

  1. enter prompt in build mode
  2. change model after some time
  3. type /compact command
  4. see that compaction doesn't work

Screenshot and/or share link

No response

Operating System

Ubuntu 24.04.3 LTS

Terminal

Alacritty

Originally created by @esau-morais on GitHub (Dec 30, 2025). Originally assigned to: @rekram1-node on GitHub. ### Description <img width="1276" height="700" alt="Image" src="https://github.com/user-attachments/assets/4f8c0efd-1a1f-4530-8b59-11e7cbc06c04" /> seems like when i change model to perform compaction-only sometimes it doesn't do anything and gets stuck in this state. if i try to run again, returns an error: > messages.1: all messages must have non-empty content except for the optional final assistant message <img width="1276" height="700" alt="Image" src="https://github.com/user-attachments/assets/0213cd62-8436-48ca-856e-39aadcea8a3a" /> ### OpenCode version 1.0.218 ### Steps to reproduce 1. enter prompt in `build` mode 2. change model after some time 3. type `/compact` command 4. see that compaction doesn't work ### Screenshot and/or share link _No response_ ### Operating System Ubuntu 24.04.3 LTS ### Terminal Alacritty
yindo added the bug label 2026-02-16 17:42:17 -05:00
yindo closed this issue 2026-02-16 17:42:17 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Dec 30, 2025):

This issue might be a duplicate of existing issues. Please check:

  • #6286: Compaction Failing to Run on Time - Similar issue where compaction fails and gets stuck
  • #6068: [BUG]: Auto compaction not triggering reliably with Anthropic models - Related compaction failures with model changes
  • #6446: Empty message content causes Anthropic API errors during compaction - May be the root cause of compaction failures with model switching

The common thread appears to be compaction failures related to message structure and/or model switching. #6446 in particular has detailed root cause analysis that might apply to your situation.

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Dec 30, 2025): This issue might be a duplicate of existing issues. Please check: - #6286: Compaction Failing to Run on Time - Similar issue where compaction fails and gets stuck - #6068: [BUG]: Auto compaction not triggering reliably with Anthropic models - Related compaction failures with model changes - #6446: Empty message content causes Anthropic API errors during compaction - May be the root cause of compaction failures with model switching The common thread appears to be compaction failures related to message structure and/or model switching. #6446 in particular has detailed root cause analysis that might apply to your situation. Feel free to ignore if none of these address your specific case.
Author
Owner

@esau-morais commented on GitHub (Dec 30, 2025):

seems to be related to #6446, closing

@esau-morais commented on GitHub (Dec 30, 2025): seems to be related to #6446, closing
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#4014