Skip to content

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

Closed

Description

@esafak

This is with anthropic claude opus 4.1, opencode 0.9.11, nushell on macos.

Activity

  1. github-actions commented on Sep 17, 2025

    @github-actions
    Contributor

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

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

  2. rekram1-node commented on Sep 17, 2025

    @rekram1-node
    Contributor

    I just fixed this: #2651

    Assuming you had a message you aborted in the session?

    U may be able to get around this by doing a /undo and then continuing

    Either way: in next release this should be fixed!

  3. self-assigned this
    on Sep 17, 2025
  4. esafak commented on Sep 17, 2025

    @esafak
    ContributorAuthor

    Aborting often results in such errors, yes. Does undo delete the last entry?

  5. rekram1-node commented on Sep 17, 2025

    @rekram1-node
    Contributor

    Yeah it will rewind to your last message so the most recent loop + last message you sent are all "deleted" (you can hit /redo too) and the prompt box will be populated with the last msg you sent

  6. rekram1-node commented on Sep 18, 2025

    @rekram1-node
    Contributor

    closing since commit to fix has been merged, will be in next release

  7. arshbot commented on Dec 27, 2025

    @arshbot

    Running into this issue again, /undo doesn't seem to get past it. Occurred after linking anthropic mid chat. chat window froze and window had to be closed.

  8. andymac4182 commented on Jan 4, 2026

    @andymac4182

    I am still getting this. It appears to have happened again.

  9. rekram1-node commented on Jan 4, 2026

    @rekram1-node
    Contributor

    @andymac4182 can u share a session?

  10. arshbot commented on Jan 4, 2026

    @arshbot

    Can reproduce by starting a session with glm, and later switching to any anthropic model.

  11. rekram1-node commented on Jan 4, 2026

    @rekram1-node
    Contributor

    ahh

  12. madeleineostoja commented on Feb 4, 2026

    @madeleineostoja

    Also still seeing this error, exclusively when interrupting an agent while thinking

  13. kiennq commented on Feb 7, 2026

    @kiennq

    I got this issue with Copilot Claude model, we should expand the check for trimming to all anthropic models, regardless of ai-sdk.

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