"AI_APICallError: Text content blocks must contain non-whitespace text" on /compact #1150

Closed
opened 2026-02-16 17:29:38 -05:00 by yindo · 14 comments
Owner

Originally created by @IshanArya on GitHub (Aug 7, 2025).

Originally assigned to: @rekram1-node on GitHub.

I am running the Claude Pro Max model with Opencode. Whenever I try to run /compact , I get the error:

AI_APICallError: system: text content blocks must contain non-whitespace text

And this ruins the formatting of the opencode terminal so I have to restart the command prompt. Eventually this makes opencode unusable because the auto-compact doesn't seem to work either.

I think the error originates from node_modules/@ai-sdk/provider/dist/index.js:62:5 .
At least, that is the minimal error I can see in the messed up opencode terminal.

Any thoughts?

Image

Originally created by @IshanArya on GitHub (Aug 7, 2025). Originally assigned to: @rekram1-node on GitHub. I am running the Claude Pro Max model with Opencode. Whenever I try to run /compact , I get the error: ``` AI_APICallError: system: text content blocks must contain non-whitespace text ``` And this ruins the formatting of the opencode terminal so I have to restart the command prompt. Eventually this makes opencode unusable because the auto-compact doesn't seem to work either. I think the error originates from `node_modules/@ai-sdk/provider/dist/index.js:62:5` . At least, that is the minimal error I can see in the messed up opencode terminal. Any thoughts? ![Image](https://github.com/user-attachments/assets/d87564c2-73d0-4e4c-9cbf-acd5c42f9142)
yindo closed this issue 2026-02-16 17:29:38 -05:00
Author
Owner

@IshanArya commented on GitHub (Aug 14, 2025):

Hi, @thdxr any idea why this might be happening so I can look into it? I really like Opencode but this bug makes it really hard to use.

I tried reinstalling Opencode and the issue persisted.

@IshanArya commented on GitHub (Aug 14, 2025): Hi, @thdxr any idea why this might be happening so I can look into it? I really like Opencode but this bug makes it really hard to use. I tried reinstalling Opencode and the issue persisted.
Author
Owner

@rekram1-node commented on GitHub (Aug 29, 2025):

What model was this?

@rekram1-node commented on GitHub (Aug 29, 2025): What model was this?
Author
Owner

@DxTa commented on GitHub (Oct 5, 2025):

I got similar issue with Opus 4.1 via claude code subscription

@DxTa commented on GitHub (Oct 5, 2025): I got similar issue with Opus 4.1 via claude code subscription
Author
Owner

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

can u share session?

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

@RaphGod commented on GitHub (Oct 12, 2025):

Hello, I've got que same problem. Build with GLM 4.6 = > 0K
when Plan Mode with Ko => AI_APICallError: messages: text content blocks must contain non-whitespace text
undo or quit and launch opencode => AI_APICallError: messages: text content blocks must contain non-whitespace text
Swap to Build mode => OK !
Swap to plan mode => KO ! AI_APICallError: messages: text content blocks must contain non-whitespace text
Swap to GLM in plan mode (instead of Claude Sonnet) ===> OK ! => make a plan => Build with GLM => Plan mode => talk with glm ok => swapto claude AI_APICallError: messages: text content blocks must contain non-whitespace text

It seems like the model Claude is fall ! But if you start a new session with Claude it is OK !
You go back to the falled session => KO : AI_APICallError: messages: text content blocks must contain non-whitespace text

The problem is in the session wich is corrupted.

@RaphGod commented on GitHub (Oct 12, 2025): Hello, I've got que same problem. Build with GLM 4.6 = > 0K when Plan Mode with Ko => AI_APICallError: messages: text content blocks must contain non-whitespace text undo or quit and launch opencode => AI_APICallError: messages: text content blocks must contain non-whitespace text Swap to Build mode => OK ! Swap to plan mode => KO ! AI_APICallError: messages: text content blocks must contain non-whitespace text Swap to GLM in plan mode (instead of Claude Sonnet) ===> OK ! => make a plan => Build with GLM => Plan mode => talk with glm ok => swapto claude AI_APICallError: messages: text content blocks must contain non-whitespace text It seems like the model Claude is fall ! But if you start a new session with Claude it is OK ! You go back to the falled session => KO : AI_APICallError: messages: text content blocks must contain non-whitespace text The problem is in the session wich is corrupted.
Author
Owner

@RaphGod commented on GitHub (Oct 12, 2025):

i can share session but not in public, tell me how I can send you

@RaphGod commented on GitHub (Oct 12, 2025): i can share session but not in public, tell me how I can send you
Author
Owner

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

@RaphGod you can dm on discord or x if that works

@rekram1-node commented on GitHub (Oct 12, 2025): @RaphGod you can dm on discord or x if that works
Author
Owner

@RaphGod commented on GitHub (Oct 12, 2025):

I sent you in X ! the first It blocked me , but the second I can :-) You can open private vunlerability in github to send private issue. Hope this will help.

@RaphGod commented on GitHub (Oct 12, 2025): I sent you in X ! the first It blocked me , but the second I can :-) You can open private vunlerability in github to send private issue. Hope this will help.
Author
Owner

@IshanArya commented on GitHub (Oct 15, 2025):

Hi I was using sonnet 4.1 before. However, with sonnet 4.5, when I call /compact, the terminal gets stuck on:

Generating...
Build claude-sonnet-4-5-20250929 (11:09 AM)
@IshanArya commented on GitHub (Oct 15, 2025): Hi I was using sonnet 4.1 before. However, with sonnet 4.5, when I call `/compact`, the terminal gets stuck on: ``` Generating... Build claude-sonnet-4-5-20250929 (11:09 AM) ```
Author
Owner

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

fix: https://github.com/sst/opencode/commit/d8a15e7bc97f15eaec6247b643d9a55a9468be3e

@rekram1-node commented on GitHub (Oct 16, 2025): fix: https://github.com/sst/opencode/commit/d8a15e7bc97f15eaec6247b643d9a55a9468be3e
Author
Owner

@reise69 commented on GitHub (Oct 24, 2025):

Hello,

I have configured the Haiku 4.5 model in default build. I am making my plan with a mixture of GLM 4.6 and Sonnet 4.5.

As soon as I switch back to build and launch the go for modifications, I get the error ‘messages: text content blocks must contain non-whitespace text’.

I only have this problem with Haiku 4.5.

Does anyone else have this problem? Thank you for your help.

@reise69 commented on GitHub (Oct 24, 2025): Hello, I have configured the Haiku 4.5 model in default build. I am making my plan with a mixture of GLM 4.6 and Sonnet 4.5. As soon as I switch back to build and launch the go for modifications, I get the error ‘messages: text content blocks must contain non-whitespace text’. I only have this problem with Haiku 4.5. Does anyone else have this problem? Thank you for your help.
Author
Owner

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

@reise69 i know what caused your issue ill fix soon

@rekram1-node commented on GitHub (Oct 24, 2025): @reise69 i know what caused your issue ill fix soon
Author
Owner

@IshanArya commented on GitHub (Oct 28, 2025):

Awesome, /compact is working now, thank you!

@IshanArya commented on GitHub (Oct 28, 2025): Awesome, `/compact` is working now, thank you!
Author
Owner

@777akot commented on GitHub (Jan 29, 2026):

/undo until your message with whitespaces

@777akot commented on GitHub (Jan 29, 2026): /undo until your message with whitespaces
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#1150