failed to send message: POST "http://127.0.0.1:53737/session/ses_7fcdb17a2ffeA A8MIzJJs741C/message": 400 Bad Request {"name":"UnknownError","data":{"message":"TypeErro r: undefined is not an object (evaluating 'U0.tokens.input')"}} #684

Closed
opened 2026-02-16 17:27:53 -05:00 by yindo · 7 comments
Owner

Originally created by @Dhruv2mars on GitHub (Jul 13, 2025).

Originally assigned to: @thdxr on GitHub.

Image
Originally created by @Dhruv2mars on GitHub (Jul 13, 2025). Originally assigned to: @thdxr on GitHub. <img width="2523" height="1275" alt="Image" src="https://github.com/user-attachments/assets/696baac1-7e6f-4edf-a90b-49cb0f2d447e" />
yindo closed this issue 2026-02-16 17:27:53 -05:00
Author
Owner

@rahul-s-bhatt commented on GitHub (Jul 13, 2025):

I m getting same issue when trying to hook it up to a local model via LMStudio.

Tested methods:

  • Deleted the .config/opencode and .cache/opencode and restarted couple of times.

Below is the opencode.json for the same.
{ "$schema": "https://opencode.ai/config.json", "provider": { "lmstudio": { "npm": "@ai-sdk/openai-compatible", "name": "LM Studio (local)", "options": { "baseURL": "http://127.0.0.1:1234/v1" }, "models": { "lm-studio/phi-3-mini-4k-instruct": { "name": "phi-3-mini-4k-instruct" } } } } }

@rahul-s-bhatt commented on GitHub (Jul 13, 2025): I m getting same issue when trying to hook it up to a local model via LMStudio. Tested methods: - Deleted the .config/opencode and .cache/opencode and restarted couple of times. Below is the opencode.json for the same. `{ "$schema": "https://opencode.ai/config.json", "provider": { "lmstudio": { "npm": "@ai-sdk/openai-compatible", "name": "LM Studio (local)", "options": { "baseURL": "http://127.0.0.1:1234/v1" }, "models": { "lm-studio/phi-3-mini-4k-instruct": { "name": "phi-3-mini-4k-instruct" } } } } }`
Author
Owner

@adityaagarw commented on GitHub (Jul 26, 2025):

I m getting same issue when trying to hook it up to a local model via LMStudio.

Tested methods:

* Deleted the .config/opencode and .cache/opencode and restarted couple of times.

Below is the opencode.json for the same. { "$schema": "https://opencode.ai/config.json", "provider": { "lmstudio": { "npm": "@ai-sdk/openai-compatible", "name": "LM Studio (local)", "options": { "baseURL": "http://127.0.0.1:1234/v1" }, "models": { "lm-studio/phi-3-mini-4k-instruct": { "name": "phi-3-mini-4k-instruct" } } } } }

For local LLMs , it usually means that the input is greater than the context window (Do check LMStudio server logs). The system prompt along with other prompts might be exceeding your context window. Default 4k context window is too low.

@adityaagarw commented on GitHub (Jul 26, 2025): > I m getting same issue when trying to hook it up to a local model via LMStudio. > > Tested methods: > > * Deleted the .config/opencode and .cache/opencode and restarted couple of times. > > > Below is the opencode.json for the same. `{ "$schema": "https://opencode.ai/config.json", "provider": { "lmstudio": { "npm": "@ai-sdk/openai-compatible", "name": "LM Studio (local)", "options": { "baseURL": "http://127.0.0.1:1234/v1" }, "models": { "lm-studio/phi-3-mini-4k-instruct": { "name": "phi-3-mini-4k-instruct" } } } } }` For local LLMs , it usually means that the input is greater than the context window (Do check LMStudio server logs). The system prompt along with other prompts might be exceeding your context window. Default 4k context window is too low.
Author
Owner

@blackhaj commented on GitHub (Jul 31, 2025):

I had the same issue. Jacking up the context length fixed it:

Image
@blackhaj commented on GitHub (Jul 31, 2025): I had the same issue. Jacking up the context length fixed it: <img width="3592" height="996" alt="Image" src="https://github.com/user-attachments/assets/16e9fdf7-8d63-4705-a544-ae4de6f6216d" />
Author
Owner

@blackhaj commented on GitHub (Jul 31, 2025):

That said, I still get other errors. It does input a response before throwing the error at least

Image
@blackhaj commented on GitHub (Jul 31, 2025): That said, I still get other errors. It does input a response before throwing the error at least <img width="1376" height="984" alt="Image" src="https://github.com/user-attachments/assets/b76f563c-1a26-4932-a015-3a96e5c260db" />
Author
Owner

@yagil commented on GitHub (Aug 1, 2025):

That said, I still get other errors. It does input a response before throwing the error at least

Image

Hey! We have fixes to this in the latest beta: https://lmstudio.ai/beta-releases

@yagil commented on GitHub (Aug 1, 2025): > That said, I still get other errors. It does input a response before throwing the error at least > > <img alt="Image" width="1376" height="984" src="https://private-user-images.githubusercontent.com/15220184/473125167-b76f563c-1a26-4932-a015-3a96e5c260db.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NTQwNzkxNjUsIm5iZiI6MTc1NDA3ODg2NSwicGF0aCI6Ii8xNTIyMDE4NC80NzMxMjUxNjctYjc2ZjU2M2MtMWEyNi00OTMyLWEwMTUtM2E5NmU1YzI2MGRiLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTA4MDElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwODAxVDIwMDc0NVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTFjMTgzM2UxODhmYmE4NzI0YzBiMjAwNTg5ODc0MjEyNzE5NDU0ZGRjYTVlN2RkMWExMzc4MzA0OTg2NDY1MTEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.wmirwkZeieEg1MsedNYW86qVhZCVFvl7QU-kxr6IewU"> Hey! We have fixes to this in the latest beta: https://lmstudio.ai/beta-releases
Author
Owner

@jayair commented on GitHub (Aug 1, 2025):

nice @yagil

@jayair commented on GitHub (Aug 1, 2025): nice @yagil
Author
Owner

@rekram1-node commented on GitHub (Dec 27, 2025):

[automated] Closing due to 90+ days of inactivity. Feel free to reopen if you still need this!

@rekram1-node commented on GitHub (Dec 27, 2025): [automated] Closing due to 90+ days of inactivity. Feel free to reopen if you still need this!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#684