Missing context after network interruption #2052

Open
opened 2026-02-16 17:33:57 -05:00 by yindo · 10 comments
Owner

Originally created by @bma-d on GitHub (Oct 11, 2025).

Originally assigned to: @rekram1-node on GitHub.

After interrupted network(Wi-fi was disconnected and the CLI gave up after a few tries) trying to resume the conversation I get the following error.

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

It seems like the CLI has lost track of all previous context.

Originally created by @bma-d on GitHub (Oct 11, 2025). Originally assigned to: @rekram1-node on GitHub. After interrupted network(Wi-fi was disconnected and the CLI gave up after a few tries) trying to resume the conversation I get the following error. ``` AI_APICallError: messages.1: all messages must have non-empty content except for the optional final assistant message ``` It seems like the CLI has lost track of all previous context.
Author
Owner

@github-actions[bot] commented on GitHub (Oct 11, 2025):

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

  • #2655: Similar AI_APICallError about messages having non-empty content (though this was with a different context - high message count rather than network interruption)

The error message is identical: messages.X: all messages must have non-empty content except for the optional final assistant message, though the root causes may differ (network interruption vs. message handling).

Feel free to ignore if this doesn't address your specific network interruption case.

@github-actions[bot] commented on GitHub (Oct 11, 2025): This issue might be a duplicate of existing issues. Please check: - #2655: Similar AI_APICallError about messages having non-empty content (though this was with a different context - high message count rather than network interruption) The error message is identical: `messages.X: all messages must have non-empty content except for the optional final assistant message`, though the root causes may differ (network interruption vs. message handling). Feel free to ignore if this doesn't address your specific network interruption case.
Author
Owner

@rekram1-node commented on GitHub (Oct 11, 2025):

I think there was a rare condition where an llm request started, didn't generate anything yet, and then connection was dropped but we saved the data. we should filter / drop these messages probably to prevent this issue...

To fix this in meantime you should be able to do a /undo (1 or more times) and that will remove broken message from context

@rekram1-node commented on GitHub (Oct 11, 2025): I think there was a rare condition where an llm request started, didn't generate anything yet, and then connection was dropped but we saved the data. we should filter / drop these messages probably to prevent this issue... To fix this in meantime you should be able to do a /undo (1 or more times) and that will remove broken message from context
Author
Owner

@bma-d commented on GitHub (Oct 11, 2025):

I think there was a rare condition where an llm request started, didn't generate anything yet, and then connection was dropped but we saved the data. we should filter / drop these messages probably to prevent this issue...

To fix this in meantime you should be able to do a /undo (1 or more times) and that will remove broken message from context

Running /undo was actually exactly what I did several times and still got the same error which was why I created this issue

@bma-d commented on GitHub (Oct 11, 2025): > I think there was a rare condition where an llm request started, didn't generate anything yet, and then connection was dropped but we saved the data. we should filter / drop these messages probably to prevent this issue... > > To fix this in meantime you should be able to do a /undo (1 or more times) and that will remove broken message from context Running /undo was actually exactly what I did several times and still got the same error which was why I created this issue
Author
Owner

@rekram1-node commented on GitHub (Oct 11, 2025):

hmm any chance u can share session?

@rekram1-node commented on GitHub (Oct 11, 2025): hmm any chance u can share session?
Author
Owner

@westito commented on GitHub (Oct 13, 2025):

I have the same, without network interruption. Usually happens when context go very large (>160k). But with compact command it always happen so basically I can't compact the session.

The second problem is, UI not handles this response and simply stuck at Generating... forever.

INFO  2025-10-13T07:09:33 +0ms service=bus type=message.updated publishing
INFO  2025-10-13T07:09:33 +1ms service=bus type=message.updated publishing
INFO  2025-10-13T07:09:33 +0ms service=bus type=message.updated publishing
INFO  2025-10-13T07:09:33 +59ms service=bus type=session.updated publishing
INFO  2025-10-13T07:09:33 +70ms service=bus type=message.updated publishing
INFO  2025-10-13T07:09:33 +245ms service=bus type=session.updated publishing
INFO  2025-10-13T07:09:33 +0ms service=session.prompt session=ses_6262b2e92ffe6KbDw8jZSvliwT sessionID=ses_6262b2e92ffe6KbDw8jZSvliwT unlocking
ERROR 2025-10-13T07:09:33 +0ms service=server error=messages.123: all messages must have non-empty content except for the optional final assistant message failed
INFO  2025-10-13T07:09:33 +0ms service=server duration=26438 response
INFO  2025-10-13T07:09:33 +0ms service=bus type=session.idle publishing
ERROR 2025-10-13T07:09:33 +1ms service=tui failed to send message: POST "http://127.0.0.1:58411/session/ses_6262b2e92ffe6KbDw8jZSvliwT/message": 400 Bad Request {"name":"UnknownError","data":{"message":"AI_APICallError: messages.123: all messages must have non-empty content except for the optional final assistant message"}}
INFO  2025-10-13T07:11:53 +139200ms service=server method=POST path=/session/ses_6262b2e92ffe6KbDw8jZSvliwT/abort request
INFO  2025-10-13T07:11:53 +1ms service=server duration=1 response
INFO  2025-10-13T07:11:55 +1920ms service=tui offset=14404 x=78 y=34 mouse
INFO  2025-10-13T07:11:55 +0ms service=tui end=-1,-1 start=78,14438 mouse selection
INFO  2025-10-13T07:11:56 +1199ms service=server method=POST path=/session/ses_6262b2e92ffe6KbDw8jZSvliwT/abort request
INFO  2025-10-13T07:11:56 +0ms service=server duration=0 response
INFO  2025-10-13T07:11:58 +2364ms service=server method=POST path=/session/ses_6262b2e92ffe6KbDw8jZSvliwT/summarize request
INFO  2025-10-13T07:11:58 +2ms service=bus type=session.updated publishing
INFO  2025-10-13T07:11:58 +307ms service=bus type=message.updated publishing
INFO  2025-10-13T07:11:59 +371ms service=bus type=session.updated publishing
ERROR 2025-10-13T07:11:59 +0ms service=server error=messages.123: all messages must have non-empty content except for the optional final assistant message failed
INFO  2025-10-13T07:11:59 +0ms service=server duration=680 response
ERROR 2025-10-13T07:11:59 +0ms service=tui error=POST "http://127.0.0.1:58411/session/ses_6262b2e92ffe6KbDw8jZSvliwT/summarize": 400 Bad Request {"name":"UnknownError","data":{"message":"AI_APICallError: messages.123: all messages must have non-empty content except for the optional final assistant message"}} Failed to compact session

@westito commented on GitHub (Oct 13, 2025): I have the same, without network interruption. Usually happens when context go very large (>160k). But with `compact` command it always happen so basically I can't compact the session. The second problem is, UI not handles this response and simply stuck at `Generating...` forever. ``` INFO 2025-10-13T07:09:33 +0ms service=bus type=message.updated publishing INFO 2025-10-13T07:09:33 +1ms service=bus type=message.updated publishing INFO 2025-10-13T07:09:33 +0ms service=bus type=message.updated publishing INFO 2025-10-13T07:09:33 +59ms service=bus type=session.updated publishing INFO 2025-10-13T07:09:33 +70ms service=bus type=message.updated publishing INFO 2025-10-13T07:09:33 +245ms service=bus type=session.updated publishing INFO 2025-10-13T07:09:33 +0ms service=session.prompt session=ses_6262b2e92ffe6KbDw8jZSvliwT sessionID=ses_6262b2e92ffe6KbDw8jZSvliwT unlocking ERROR 2025-10-13T07:09:33 +0ms service=server error=messages.123: all messages must have non-empty content except for the optional final assistant message failed INFO 2025-10-13T07:09:33 +0ms service=server duration=26438 response INFO 2025-10-13T07:09:33 +0ms service=bus type=session.idle publishing ERROR 2025-10-13T07:09:33 +1ms service=tui failed to send message: POST "http://127.0.0.1:58411/session/ses_6262b2e92ffe6KbDw8jZSvliwT/message": 400 Bad Request {"name":"UnknownError","data":{"message":"AI_APICallError: messages.123: all messages must have non-empty content except for the optional final assistant message"}} INFO 2025-10-13T07:11:53 +139200ms service=server method=POST path=/session/ses_6262b2e92ffe6KbDw8jZSvliwT/abort request INFO 2025-10-13T07:11:53 +1ms service=server duration=1 response INFO 2025-10-13T07:11:55 +1920ms service=tui offset=14404 x=78 y=34 mouse INFO 2025-10-13T07:11:55 +0ms service=tui end=-1,-1 start=78,14438 mouse selection INFO 2025-10-13T07:11:56 +1199ms service=server method=POST path=/session/ses_6262b2e92ffe6KbDw8jZSvliwT/abort request INFO 2025-10-13T07:11:56 +0ms service=server duration=0 response INFO 2025-10-13T07:11:58 +2364ms service=server method=POST path=/session/ses_6262b2e92ffe6KbDw8jZSvliwT/summarize request INFO 2025-10-13T07:11:58 +2ms service=bus type=session.updated publishing INFO 2025-10-13T07:11:58 +307ms service=bus type=message.updated publishing INFO 2025-10-13T07:11:59 +371ms service=bus type=session.updated publishing ERROR 2025-10-13T07:11:59 +0ms service=server error=messages.123: all messages must have non-empty content except for the optional final assistant message failed INFO 2025-10-13T07:11:59 +0ms service=server duration=680 response ERROR 2025-10-13T07:11:59 +0ms service=tui error=POST "http://127.0.0.1:58411/session/ses_6262b2e92ffe6KbDw8jZSvliwT/summarize": 400 Bad Request {"name":"UnknownError","data":{"message":"AI_APICallError: messages.123: all messages must have non-empty content except for the optional final assistant message"}} Failed to compact session ```
Author
Owner

@westito commented on GitHub (Oct 13, 2025):

Export:

conversation-1180351177.md

As I see export not contains the end of conversation

Image
@westito commented on GitHub (Oct 13, 2025): Export: [conversation-1180351177.md](https://github.com/user-attachments/files/22878718/conversation-1180351177.md) As I see export not contains the end of conversation <img width="1101" height="899" alt="Image" src="https://github.com/user-attachments/assets/98f1700a-5b27-4f3b-9bee-5fdf9a45ece9" />
Author
Owner

@bma-d commented on GitHub (Oct 20, 2025):

Export:

conversation-1180351177.md

As I see export not contains the end of conversation

Image

That's probably exactly what's happening, the last part is not being tracked haha

@bma-d commented on GitHub (Oct 20, 2025): > Export: > > [conversation-1180351177.md](https://github.com/user-attachments/files/22878718/conversation-1180351177.md) > > As I see export not contains the end of conversation > > <img alt="Image" width="1101" height="899" src="https://private-user-images.githubusercontent.com/536799/500388622-98f1700a-5b27-4f3b-9bee-5fdf9a45ece9.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NjEwMTc0MTgsIm5iZiI6MTc2MTAxNzExOCwicGF0aCI6Ii81MzY3OTkvNTAwMzg4NjIyLTk4ZjE3MDBhLTViMjctNGYzYi05YmVlLTVmZGY5YTQ1ZWNlOS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUxMDIxJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MTAyMVQwMzI1MThaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1iZmIxMzgwOTNjYWQwNzAxYzM1YzJiZTliZmUxZTRjMmNlZjA3OTVjMmU1NTllMjJlMjk3MDViMGZkYjU3ZWU4JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.YtWVC9N4rIDX0ENuENKcFBx-6476KT-Fi_XfrUycqqY"> That's probably exactly what's happening, the last part is not being tracked haha
Author
Owner

@bma-d commented on GitHub (Oct 20, 2025):

hmm any chance u can share session?

I couldn't find it and I think the above session not having the details was exactly why

@bma-d commented on GitHub (Oct 20, 2025): > hmm any chance u can share session? I couldn't find it and I think the above session not having the details was exactly why
Author
Owner

@rekram1-node commented on GitHub (Oct 21, 2025):

I think this should be an easy fix, I know what we need to do: drop the empty text parts, may need to just filter them out will look at it

@rekram1-node commented on GitHub (Oct 21, 2025): I think this should be an easy fix, I know what we need to do: drop the empty text parts, may need to just filter them out will look at it
Author
Owner

@ujjwaljainnn commented on GitHub (Feb 10, 2026):

Image

Reproduced on v1.1.53 — Plan mode, Claude Opus 4.6, max variant. Aborting during thinking (before any text output) in a long session causes messages.X: all messages must have non-empty content on the next message. I have a fix in mind — can I submit a PR?

@ujjwaljainnn commented on GitHub (Feb 10, 2026): <img width="1184" height="479" alt="Image" src="https://github.com/user-attachments/assets/58a996e2-969d-4f60-a4d6-d9dfab98edbd" /> Reproduced on v1.1.53 — Plan mode, Claude Opus 4.6, max variant. Aborting during thinking (before any text output) in a long session causes messages.X: all messages must have non-empty content on the next message. I have a fix in mind — can I submit a PR?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#2052