Skip to content

Missing context after network interruption #3101

Closed

Description

@bma-d

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.

Activity

  1. github-actions commented on Oct 11, 2025

    @github-actions
    Contributor

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

    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.

  2. rekram1-node commented on Oct 11, 2025

    @rekram1-node
    Contributor

    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

  3. self-assigned this
    on Oct 11, 2025
  4. bma-d commented on Oct 11, 2025

    @bma-d
    Author

    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

  5. rekram1-node commented on Oct 11, 2025

    @rekram1-node
    Contributor

    hmm any chance u can share session?

  6. westito commented on Oct 13, 2025

    @westito

    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
    
    
  7. westito commented on Oct 13, 2025

    @westito

    Export:

    conversation-1180351177.md

    As I see export not contains the end of conversation

    Image
  8. bma-d commented on Oct 21, 2025

    @bma-d
    Author

    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

  9. bma-d commented on Oct 21, 2025

    @bma-d
    Author

    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

  10. rekram1-node commented on Oct 21, 2025

    @rekram1-node
    Contributor

    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

  11. ujjwaljainnn commented on Feb 10, 2026

    @ujjwaljainnn
    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?

  12. github-actions commented on Apr 12, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions