Opencode is picking random ports to connect to LM Studio #1620

Closed
opened 2026-02-16 17:31:47 -05:00 by yindo · 13 comments
Owner

Originally created by @evanmiller2112 on GitHub (Sep 5, 2025).

Originally assigned to: @thdxr on GitHub.

Hello!

I've recently set up Opencode 0.6.4 to connect to LM Studio. LM Studio is running on "PC A", and Opencode is on "PC B". I'm running an SSH tunnel to open port 1234 on PC B to connect to port 1234 on PC A. When I execute commands via curl, it returns as expected. When I try to connect to models running on PC A, using opencode running on PC B, it seems to pick a random dynamic port for this job? I don't understand what's happening, but the traffic isn't even making it over the SSH tunnel (which I can monitor via verbose mode.)

In the screenshot below, the left shows my openconde.json config and a curl command behaving as expected. The right shows opencode with an error message using a random port number to attempt to connect to LM Studio.

Image

OS: PC A = Windows 11, PC B = MacOS 15.6.1, using Terminal.

Originally created by @evanmiller2112 on GitHub (Sep 5, 2025). Originally assigned to: @thdxr on GitHub. Hello! I've recently set up Opencode 0.6.4 to connect to LM Studio. LM Studio is running on "PC A", and Opencode is on "PC B". I'm running an SSH tunnel to open port 1234 on PC B to connect to port 1234 on PC A. When I execute commands via curl, it returns as expected. When I try to connect to models running on PC A, using opencode running on PC B, it seems to pick a random dynamic port for this job? I don't understand what's happening, but the traffic isn't even making it over the SSH tunnel (which I can monitor via verbose mode.) In the screenshot below, the left shows my openconde.json config and a curl command behaving as expected. The right shows opencode with an error message using a random port number to attempt to connect to LM Studio. <img width="1792" height="1100" alt="Image" src="https://github.com/user-attachments/assets/c28ed6b5-c10b-4033-ac1a-604c63bf4ac7" /> OS: PC A = Windows 11, PC B = MacOS 15.6.1, using Terminal.
yindo closed this issue 2026-02-16 17:31:47 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Sep 5, 2025):

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

  • #2365: Similar issue where custom URL port changes to a random port when running in a git project directory vs. a normal directory

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

@github-actions[bot] commented on GitHub (Sep 5, 2025): This issue might be a duplicate of existing issues. Please check: - #2365: Similar issue where custom URL port changes to a random port when running in a git project directory vs. a normal directory Feel free to ignore if none of these address your specific case.
Author
Owner

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

That port you are seeing is the opencode backend that runs on your machine

@rekram1-node commented on GitHub (Sep 5, 2025): That port you are seeing is the opencode backend that runs on your machine
Author
Owner

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

can you show your latest log file from ~/.local/share/opencode/log?

I can help you debug the error

@rekram1-node commented on GitHub (Sep 5, 2025): can you show your latest log file from ~/.local/share/opencode/log? I can help you debug the error
Author
Owner

@evanmiller2112 commented on GitHub (Sep 5, 2025):

I made some of what I thought were trivial changes to the opencode.json file and it started working? I'm not sure why. I'll share the log here too just in case, in a sec.

{
 "$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": {
    "qwen/qwen3-coder-30b": {
     "id": "qwen/qwen3-coder-30b",
     "reasoning": true,
     "tool_call": true
    }
   }
  }
 }
}
@evanmiller2112 commented on GitHub (Sep 5, 2025): I made some of what I thought were trivial changes to the opencode.json file and it started working? I'm not sure why. I'll share the log here too just in case, in a sec. ``` { "$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": { "qwen/qwen3-coder-30b": { "id": "qwen/qwen3-coder-30b", "reasoning": true, "tool_call": true } } } } } ```
Author
Owner

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

might be that provider name thing, idk if it supports spaces

@rekram1-node commented on GitHub (Sep 5, 2025): might be that provider name thing, idk if it supports spaces
Author
Owner

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

what happens if you add a space again haha

if it breaks I can add validation

@rekram1-node commented on GitHub (Sep 5, 2025): what happens if you add a space again haha if it breaks I can add validation
Author
Owner

@evanmiller2112 commented on GitHub (Sep 5, 2025):

2025-09-05T194111.log
2025-09-05T194402.log
2025-09-05T195327.log

I threw some log files in here.

Looking at them it looks like there's a bun cert error in there.. is it possible that the actual issue was that bun couldn't pull the spec it needed, and the UI displayed mostly unrelated error?

@evanmiller2112 commented on GitHub (Sep 5, 2025): [2025-09-05T194111.log](https://github.com/user-attachments/files/22180052/2025-09-05T194111.log) [2025-09-05T194402.log](https://github.com/user-attachments/files/22180053/2025-09-05T194402.log) [2025-09-05T195327.log](https://github.com/user-attachments/files/22180051/2025-09-05T195327.log) I threw some log files in here. Looking at them it looks like there's a `bun` cert error in there.. is it possible that the actual issue was that bun couldn't pull the spec it needed, and the UI displayed mostly unrelated error?
Author
Owner

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

Yeah this looks like culprit:

NFO  2025-09-05T19:41:19 +286ms service=bun code=1 stdout=bun add v1.2.19 (aad3abea)
 stderr=Resolving dependencies
Resolved, downloaded and extracted [6]
error: UNABLE_TO_GET_ISSUER_CERT downloading package manifest @ai-sdk/openai-compatible
 done
INFO  2025-09-05T19:41:19 +1ms service=provider status=completed duration=302 providerID=lm studio getSDK
ERROR 2025-09-05T19:41:19 +2ms service=server error=ProviderInitError Caused by: BunInstallFailedError Caused by: Command failed with exit code 1 failed
INFO  2025-09-05T19:41:19 +0ms service=server duration=311 response
INFO  2025-09-05T19:41:19 +0ms service=project directory=/Users/evan/git/qwen-code fromDirectory
ERROR 2025-09-05T19:41:19 +1ms service=tui failed to send message: POST "http://127.0.0.1:57641/session/ses_6e49a392bffe03yRnxPkcAisSr/message": 400 Bad Request {"name":"ProviderInitError","data":{"providerID":"lm studio"}}
INFO  2025-09-05T19:41:50 +31690ms service=bus type=* unsubscribing
INFO  2025-09-05T19:41:50 +1ms service=server event disconnected
@rekram1-node commented on GitHub (Sep 5, 2025): Yeah this looks like culprit: ``` NFO 2025-09-05T19:41:19 +286ms service=bun code=1 stdout=bun add v1.2.19 (aad3abea) stderr=Resolving dependencies Resolved, downloaded and extracted [6] error: UNABLE_TO_GET_ISSUER_CERT downloading package manifest @ai-sdk/openai-compatible done INFO 2025-09-05T19:41:19 +1ms service=provider status=completed duration=302 providerID=lm studio getSDK ERROR 2025-09-05T19:41:19 +2ms service=server error=ProviderInitError Caused by: BunInstallFailedError Caused by: Command failed with exit code 1 failed INFO 2025-09-05T19:41:19 +0ms service=server duration=311 response INFO 2025-09-05T19:41:19 +0ms service=project directory=/Users/evan/git/qwen-code fromDirectory ERROR 2025-09-05T19:41:19 +1ms service=tui failed to send message: POST "http://127.0.0.1:57641/session/ses_6e49a392bffe03yRnxPkcAisSr/message": 400 Bad Request {"name":"ProviderInitError","data":{"providerID":"lm studio"}} INFO 2025-09-05T19:41:50 +31690ms service=bus type=* unsubscribing INFO 2025-09-05T19:41:50 +1ms service=server event disconnected ```
Author
Owner

@evanmiller2112 commented on GitHub (Sep 5, 2025):

Okay so it's very strange. Obviously things are working for me now and that's great - I got whatever bun package installed through whatever corporate blockers I might have here and we're good..

but this message... ERROR 2025-09-05T19:41:19 +1ms service=tui failed to send message: POST "http://127.0.0.1:57641/session/ses_6e49a392bffe03yRnxPkcAisSr/message": 400 Bad Request {"name":"ProviderInitError","data":{"providerID":"lm studio"}}

is that still an issue? Why's it sending stuff to that random port when the error happens, but not otherwise? (Very much could be my ignorance, just want to make sure we don't ignore a potential problem if there is one)

@evanmiller2112 commented on GitHub (Sep 5, 2025): Okay so it's very strange. Obviously things are working for me now and that's great - I got whatever bun package installed through whatever corporate blockers I might have here and we're good.. but this message... `ERROR 2025-09-05T19:41:19 +1ms service=tui failed to send message: POST "http://127.0.0.1:57641/session/ses_6e49a392bffe03yRnxPkcAisSr/message": 400 Bad Request {"name":"ProviderInitError","data":{"providerID":"lm studio"}}` is that still an issue? Why's it sending stuff to that random port when the error happens, but not otherwise? (Very much could be my ignorance, just want to make sure we don't ignore a potential problem if there is one)
Author
Owner

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

Yeah so opencode has 2 processes:

  • parent server (this is the "backend" it is a local server on YOUR machine and the purpose here is to allow multiple "frontends" in future)
  • tui process (this sends HTTP requests to the server on your machine)

Seems like the provider failed to initialize properly so when the TUI tried to send a request to it it failed due to the provider failing to initialize hence ProviderInitError

TLDR this is expected behavior but the error UX could be better 100%

@rekram1-node commented on GitHub (Sep 5, 2025): Yeah so opencode has 2 processes: - parent server (this is the "backend" it is a local server on YOUR machine and the purpose here is to allow multiple "frontends" in future) - tui process (this sends HTTP requests to the server on your machine) Seems like the provider failed to initialize properly so when the TUI tried to send a request to it it failed due to the provider failing to initialize hence `ProviderInitError` TLDR this is expected behavior but the error UX could be better 100%
Author
Owner

@rekram1-node commented on GitHub (Sep 23, 2025):

@evanmiller2112 still having this issue? I am going to close for now unless you are still having it

@rekram1-node commented on GitHub (Sep 23, 2025): @evanmiller2112 still having this issue? I am going to close for now unless you are still having it
Author
Owner

@cybardev commented on GitHub (Oct 18, 2025):

@rekram1-node I am getting a similar error with the following config:

{
  "$schema": "https://opencode.ai/config.json",
  "autoupdate": false,
  "command": {
    "ctx": {
      "description": "Prompt with context7 MCP server.",
      "template": "$ARGUMENTS. use context7"
    },
    "hi": {
      "agent": "build",
      "description": "Say hi. Confirms readiness.",
      "template": "echo hi"
    }
  },
  "instructions": [
    "CONTRIBUTING.md",
    "docs/guidelines.md",
    ".cursor/rules/*.md"
  ],
  "mcp": {
    "context7": {
      "command": ["bun", "x", "@upstash/context7-mcp"],
      "enabled": true,
      "type": "local"
    }
  },
  "model": "lmstudio/qwen/qwen2.5-coder-14b",
  "provider": {
    "lmstudio": {
      "models": { "qwen/qwen2.5-coder-14b": { "name": "Qwen 2.5 Coder" } },
      "name": "LM Studio",
      "npm": "@ai-sdk/openai-compatible",
      "options": { "baseURL": "http://localhost:1234/v1" }
    }
  },
  "theme": "aura"
}

I just said hi (the command /hi gives same result) and got this:
Image

Latest log file (click to open)
INFO  2025-10-18T23:10:37 +77ms service=default version=0.15.2 args=[] opencode
INFO  2025-10-18T23:10:37 +3ms service=project directory=/Users/sage/.config/nixos fromDirectory
INFO  2025-10-18T23:10:38 +200ms service=config path=/Users/sage/.config/opencode/config.json loading
INFO  2025-10-18T23:10:38 +0ms service=config path=/Users/sage/.config/opencode/opencode.json loading
INFO  2025-10-18T23:10:38 +4ms service=config path=/Users/sage/.config/opencode/opencode.jsonc loading
INFO  2025-10-18T23:10:38 +3ms service=bun cmd=["/nix/store/k28iv28i21j1yhm4x3bamxa7d46si22y-opencode-0.15.2/bin/.opencode-wrapped","add","@opencode-ai/plugin@0.15.2","--exact"] cwd=/Users/sage/.config/opencode running
INFO  2025-10-18T23:10:38 +3ms service=plugin path=opencode-copilot-auth@0.0.3 loading plugin
INFO  2025-10-18T23:10:38 +11ms service=plugin path=opencode-anthropic-auth@0.0.2 loading plugin
INFO  2025-10-18T23:10:38 +30ms service=bus type=* subscribing
INFO  2025-10-18T23:10:38 +0ms service=bus type=session.updated subscribing
INFO  2025-10-18T23:10:38 +0ms service=bus type=message.updated subscribing
INFO  2025-10-18T23:10:38 +0ms service=bus type=message.part.updated subscribing
INFO  2025-10-18T23:10:38 +0ms service=format init
INFO  2025-10-18T23:10:38 +1ms service=bus type=file.edited subscribing
INFO  2025-10-18T23:10:38 +3ms service=lsp serverIds=typescript, vue, eslint, gopls, ruby-lsp, pyright, elixir-ls, zls, csharp, rust, clangd, svelte, jdtls enabled LSP servers
INFO  2025-10-18T23:10:38 +1ms service=models.dev file={} refreshing
INFO  2025-10-18T23:10:38 +2ms service=bun code=0 stdout=bun add v1.3.0 (b0a6feca)

installed @opencode-ai/plugin@0.15.2

[14.00ms] done
 stderr=Saved lockfile
 done
INFO  2025-10-18T23:10:38 +2ms service=provider init
INFO  2025-10-18T23:10:38 +1ms service=provider providerID=opencode found
INFO  2025-10-18T23:10:38 +0ms service=provider providerID=lmstudio found
INFO  2025-10-18T23:10:38 +7ms service=default cmd=["/Users/sage/.cache/opencode/tui/tui-d3nbe23x."] tui
INFO  2025-10-18T23:10:38 +72ms service=server method=GET path=/agent request
INFO  2025-10-18T23:10:38 +2ms service=server duration=2 response
INFO  2025-10-18T23:10:38 +1ms service=server method=GET path=/path request
INFO  2025-10-18T23:10:38 +1ms service=server duration=1 response
INFO  2025-10-18T23:10:38 +0ms service=server method=GET path=/project/current request
INFO  2025-10-18T23:10:38 +0ms service=server duration=0 response
INFO  2025-10-18T23:10:38 +4ms service=server method=GET path=/config request
INFO  2025-10-18T23:10:38 +0ms service=server duration=0 response
INFO  2025-10-18T23:10:38 +5ms service=server method=GET path=/command request
INFO  2025-10-18T23:10:38 +0ms service=server duration=0 response
INFO  2025-10-18T23:10:38 +1ms service=server method=GET path=/file/status request
INFO  2025-10-18T23:10:38 +1ms service=tui commands={"agent_cycle":{},"agent_cycle_reverse":{},"agent_list":{},"app_exit":{},"app_help":{},"ctx":{},"editor_open":{},"hi":{},"input_clear":{},"input_newline":{},"input_paste":{},"input_submit":{},"messages_copy":{},"messages_first":{},"messages_half_page_down":{},"messages_half_page_up":{},"messages_last":{},"messages_page_down":{},"messages_page_up":{},"messages_redo":{},"messages_undo":{},"model_cycle_recent":{},"model_cycle_recent_reverse":{},"model_list":{},"project_init":{},"session_child_cycle":{},"session_child_cycle_reverse":{},"session_compact":{},"session_export":{},"session_interrupt":{},"session_list":{},"session_new":{},"session_share":{},"session_timeline":{},"session_unshare":{},"theme_list":{},"thinking_blocks":{},"tool_details":{}} Loaded commands
INFO  2025-10-18T23:10:38 +4ms service=server method=GET path=/event request
INFO  2025-10-18T23:10:38 +1ms service=server event connected
INFO  2025-10-18T23:10:38 +1ms service=bus type=* subscribing
INFO  2025-10-18T23:10:38 +1ms service=server duration=3 response
INFO  2025-10-18T23:10:38 +1ms service=server method=GET path=/config/providers request
INFO  2025-10-18T23:10:38 +0ms service=server duration=0 response
INFO  2025-10-18T23:10:38 +0ms service=server method=GET path=/tui/control/next request
INFO  2025-10-18T23:10:38 +22ms service=server duration=31 response
INFO  2025-10-18T23:10:39 +1385ms service=server method=POST path=/session request
INFO  2025-10-18T23:10:39 +2ms service=session id=ses_606691b9cffeudEbIegvHWl05t version=0.15.2 projectID=89f34abaaf3f1e37f8ed37aff0273e2e780127e1 directory=/Users/sage/.config/nixos title=New session - 2025-10-18T23:10:39.715Z time={"created":1760829039715,"updated":1760829039715} created
INFO  2025-10-18T23:10:39 +1ms service=bus type=session.updated publishing
INFO  2025-10-18T23:10:39 +1ms service=server duration=4 response
INFO  2025-10-18T23:10:39 +8ms service=server method=POST path=/session/ses_606691b9cffeudEbIegvHWl05t/message request
INFO  2025-10-18T23:10:39 +4ms service=session.prompt session=ses_606691b9cffeudEbIegvHWl05t prompt
INFO  2025-10-18T23:10:39 +6ms service=bus type=message.updated publishing
INFO  2025-10-18T23:10:39 +2ms service=bus type=message.part.updated publishing
INFO  2025-10-18T23:10:39 +1ms service=bus type=session.updated publishing
INFO  2025-10-18T23:10:39 +0ms service=provider providerID=lmstudio modelID=qwen/qwen2.5-coder-14b getModel
INFO  2025-10-18T23:10:39 +1ms service=provider status=started providerID=lmstudio getSDK
INFO  2025-10-18T23:10:39 +60ms service=provider status=completed duration=60 providerID=lmstudio getSDK
INFO  2025-10-18T23:10:39 +0ms service=provider providerID=lmstudio modelID=qwen/qwen2.5-coder-14b found
INFO  2025-10-18T23:10:39 +0ms service=session.prompt session=ses_606691b9cffeudEbIegvHWl05t sessionID=ses_606691b9cffeudEbIegvHWl05t locking
INFO  2025-10-18T23:10:39 +19ms service=mcp key=context7 type=local found
INFO  2025-10-18T23:10:40 +292ms service=bus type=message.updated publishing
INFO  2025-10-18T23:10:40 +4ms service=session.prompt session=ses_606691b9cffeudEbIegvHWl05t process
INFO  2025-10-18T23:10:40 +3ms service=session.prompt session=ses_606691b9cffeudEbIegvHWl05t type=start part
ERROR 2025-10-18T23:10:40 +335ms service=session.prompt session=ses_606691b9cffeudEbIegvHWl05t error={"error":"The number of tokens to keep from the initial prompt is greater than the context length. Try to load the model with a larger context length, or provide a shorter input"} stream error
INFO  2025-10-18T23:10:40 +0ms service=session.prompt session=ses_606691b9cffeudEbIegvHWl05t type=start-step part
INFO  2025-10-18T23:10:40 +2ms service=bus type=message.part.updated publishing
INFO  2025-10-18T23:10:40 +18ms service=snapshot initialized
INFO  2025-10-18T23:10:40 +151ms service=snapshot hash=d9401cc1427b8890c5c61de75030a5d3385c406d
 cwd=/Users/sage/.config/nixos git=/Users/sage/.local/share/opencode/snapshot/89f34abaaf3f1e37f8ed37aff0273e2e780127e1 tracking
INFO  2025-10-18T23:10:40 +0ms service=session.prompt session=ses_606691b9cffeudEbIegvHWl05t type=error part
ERROR 2025-10-18T23:10:40 +1ms service=session.prompt session=ses_606691b9cffeudEbIegvHWl05t error=The number of tokens to keep from the initial prompt is greater than the context length. Try to load the model with a larger context length, or provide a shorter input process
INFO  2025-10-18T23:10:40 +1ms service=bus type=message.updated publishing
INFO  2025-10-18T23:10:40 +0ms service=session.prompt session=ses_606691b9cffeudEbIegvHWl05t sessionID=ses_606691b9cffeudEbIegvHWl05t unlocking
ERROR 2025-10-18T23:10:40 +0ms service=server error="The number of tokens to keep from the initial prompt is greater than the context length. Try to load the model with a larger context length, or provide a shorter input" is not an Object. (evaluating '"name" in input') failed
INFO  2025-10-18T23:10:40 +0ms service=server duration=900 response
INFO  2025-10-18T23:10:40 +0ms service=bus type=session.idle publishing
ERROR 2025-10-18T23:10:40 +1ms service=tui failed to send message: POST "http://127.0.0.1:51738/session/ses_606691b9cffeudEbIegvHWl05t/message": 400 Bad Request {"name":"UnknownError","data":{"message":"TypeError: \"The number of tokens to keep from the initial prompt is greater than the context length. Try to load the model with a larger context length, or provide a shorter input\" is not an Object. (evaluating '\"name\" in input')\n    at isInstance (/$bunfs/root/opencode:64186:26)\n    at process (/$bunfs/root/opencode:104913:56)\n    at processTicksAndRejections (native:7:39)"}}
INFO  2025-10-18T23:10:42 +2092ms service=bus type=* unsubscribing
INFO  2025-10-18T23:10:42 +0ms service=server event disconnected

Is this potentially related, or should I open a new issue?

@cybardev commented on GitHub (Oct 18, 2025): @rekram1-node I am getting a similar error with the following config: ```json { "$schema": "https://opencode.ai/config.json", "autoupdate": false, "command": { "ctx": { "description": "Prompt with context7 MCP server.", "template": "$ARGUMENTS. use context7" }, "hi": { "agent": "build", "description": "Say hi. Confirms readiness.", "template": "echo hi" } }, "instructions": [ "CONTRIBUTING.md", "docs/guidelines.md", ".cursor/rules/*.md" ], "mcp": { "context7": { "command": ["bun", "x", "@upstash/context7-mcp"], "enabled": true, "type": "local" } }, "model": "lmstudio/qwen/qwen2.5-coder-14b", "provider": { "lmstudio": { "models": { "qwen/qwen2.5-coder-14b": { "name": "Qwen 2.5 Coder" } }, "name": "LM Studio", "npm": "@ai-sdk/openai-compatible", "options": { "baseURL": "http://localhost:1234/v1" } } }, "theme": "aura" } ``` I just said `hi` (the command `/hi` gives same result) and got this: <img width="639" height="221" alt="Image" src="https://github.com/user-attachments/assets/3a3c2862-4b58-48a4-8c90-9a9a6b213a21" /> <details><summary>Latest log file (click to open)</summary> ``` INFO 2025-10-18T23:10:37 +77ms service=default version=0.15.2 args=[] opencode INFO 2025-10-18T23:10:37 +3ms service=project directory=/Users/sage/.config/nixos fromDirectory INFO 2025-10-18T23:10:38 +200ms service=config path=/Users/sage/.config/opencode/config.json loading INFO 2025-10-18T23:10:38 +0ms service=config path=/Users/sage/.config/opencode/opencode.json loading INFO 2025-10-18T23:10:38 +4ms service=config path=/Users/sage/.config/opencode/opencode.jsonc loading INFO 2025-10-18T23:10:38 +3ms service=bun cmd=["/nix/store/k28iv28i21j1yhm4x3bamxa7d46si22y-opencode-0.15.2/bin/.opencode-wrapped","add","@opencode-ai/plugin@0.15.2","--exact"] cwd=/Users/sage/.config/opencode running INFO 2025-10-18T23:10:38 +3ms service=plugin path=opencode-copilot-auth@0.0.3 loading plugin INFO 2025-10-18T23:10:38 +11ms service=plugin path=opencode-anthropic-auth@0.0.2 loading plugin INFO 2025-10-18T23:10:38 +30ms service=bus type=* subscribing INFO 2025-10-18T23:10:38 +0ms service=bus type=session.updated subscribing INFO 2025-10-18T23:10:38 +0ms service=bus type=message.updated subscribing INFO 2025-10-18T23:10:38 +0ms service=bus type=message.part.updated subscribing INFO 2025-10-18T23:10:38 +0ms service=format init INFO 2025-10-18T23:10:38 +1ms service=bus type=file.edited subscribing INFO 2025-10-18T23:10:38 +3ms service=lsp serverIds=typescript, vue, eslint, gopls, ruby-lsp, pyright, elixir-ls, zls, csharp, rust, clangd, svelte, jdtls enabled LSP servers INFO 2025-10-18T23:10:38 +1ms service=models.dev file={} refreshing INFO 2025-10-18T23:10:38 +2ms service=bun code=0 stdout=bun add v1.3.0 (b0a6feca) installed @opencode-ai/plugin@0.15.2 [14.00ms] done stderr=Saved lockfile done INFO 2025-10-18T23:10:38 +2ms service=provider init INFO 2025-10-18T23:10:38 +1ms service=provider providerID=opencode found INFO 2025-10-18T23:10:38 +0ms service=provider providerID=lmstudio found INFO 2025-10-18T23:10:38 +7ms service=default cmd=["/Users/sage/.cache/opencode/tui/tui-d3nbe23x."] tui INFO 2025-10-18T23:10:38 +72ms service=server method=GET path=/agent request INFO 2025-10-18T23:10:38 +2ms service=server duration=2 response INFO 2025-10-18T23:10:38 +1ms service=server method=GET path=/path request INFO 2025-10-18T23:10:38 +1ms service=server duration=1 response INFO 2025-10-18T23:10:38 +0ms service=server method=GET path=/project/current request INFO 2025-10-18T23:10:38 +0ms service=server duration=0 response INFO 2025-10-18T23:10:38 +4ms service=server method=GET path=/config request INFO 2025-10-18T23:10:38 +0ms service=server duration=0 response INFO 2025-10-18T23:10:38 +5ms service=server method=GET path=/command request INFO 2025-10-18T23:10:38 +0ms service=server duration=0 response INFO 2025-10-18T23:10:38 +1ms service=server method=GET path=/file/status request INFO 2025-10-18T23:10:38 +1ms service=tui commands={"agent_cycle":{},"agent_cycle_reverse":{},"agent_list":{},"app_exit":{},"app_help":{},"ctx":{},"editor_open":{},"hi":{},"input_clear":{},"input_newline":{},"input_paste":{},"input_submit":{},"messages_copy":{},"messages_first":{},"messages_half_page_down":{},"messages_half_page_up":{},"messages_last":{},"messages_page_down":{},"messages_page_up":{},"messages_redo":{},"messages_undo":{},"model_cycle_recent":{},"model_cycle_recent_reverse":{},"model_list":{},"project_init":{},"session_child_cycle":{},"session_child_cycle_reverse":{},"session_compact":{},"session_export":{},"session_interrupt":{},"session_list":{},"session_new":{},"session_share":{},"session_timeline":{},"session_unshare":{},"theme_list":{},"thinking_blocks":{},"tool_details":{}} Loaded commands INFO 2025-10-18T23:10:38 +4ms service=server method=GET path=/event request INFO 2025-10-18T23:10:38 +1ms service=server event connected INFO 2025-10-18T23:10:38 +1ms service=bus type=* subscribing INFO 2025-10-18T23:10:38 +1ms service=server duration=3 response INFO 2025-10-18T23:10:38 +1ms service=server method=GET path=/config/providers request INFO 2025-10-18T23:10:38 +0ms service=server duration=0 response INFO 2025-10-18T23:10:38 +0ms service=server method=GET path=/tui/control/next request INFO 2025-10-18T23:10:38 +22ms service=server duration=31 response INFO 2025-10-18T23:10:39 +1385ms service=server method=POST path=/session request INFO 2025-10-18T23:10:39 +2ms service=session id=ses_606691b9cffeudEbIegvHWl05t version=0.15.2 projectID=89f34abaaf3f1e37f8ed37aff0273e2e780127e1 directory=/Users/sage/.config/nixos title=New session - 2025-10-18T23:10:39.715Z time={"created":1760829039715,"updated":1760829039715} created INFO 2025-10-18T23:10:39 +1ms service=bus type=session.updated publishing INFO 2025-10-18T23:10:39 +1ms service=server duration=4 response INFO 2025-10-18T23:10:39 +8ms service=server method=POST path=/session/ses_606691b9cffeudEbIegvHWl05t/message request INFO 2025-10-18T23:10:39 +4ms service=session.prompt session=ses_606691b9cffeudEbIegvHWl05t prompt INFO 2025-10-18T23:10:39 +6ms service=bus type=message.updated publishing INFO 2025-10-18T23:10:39 +2ms service=bus type=message.part.updated publishing INFO 2025-10-18T23:10:39 +1ms service=bus type=session.updated publishing INFO 2025-10-18T23:10:39 +0ms service=provider providerID=lmstudio modelID=qwen/qwen2.5-coder-14b getModel INFO 2025-10-18T23:10:39 +1ms service=provider status=started providerID=lmstudio getSDK INFO 2025-10-18T23:10:39 +60ms service=provider status=completed duration=60 providerID=lmstudio getSDK INFO 2025-10-18T23:10:39 +0ms service=provider providerID=lmstudio modelID=qwen/qwen2.5-coder-14b found INFO 2025-10-18T23:10:39 +0ms service=session.prompt session=ses_606691b9cffeudEbIegvHWl05t sessionID=ses_606691b9cffeudEbIegvHWl05t locking INFO 2025-10-18T23:10:39 +19ms service=mcp key=context7 type=local found INFO 2025-10-18T23:10:40 +292ms service=bus type=message.updated publishing INFO 2025-10-18T23:10:40 +4ms service=session.prompt session=ses_606691b9cffeudEbIegvHWl05t process INFO 2025-10-18T23:10:40 +3ms service=session.prompt session=ses_606691b9cffeudEbIegvHWl05t type=start part ERROR 2025-10-18T23:10:40 +335ms service=session.prompt session=ses_606691b9cffeudEbIegvHWl05t error={"error":"The number of tokens to keep from the initial prompt is greater than the context length. Try to load the model with a larger context length, or provide a shorter input"} stream error INFO 2025-10-18T23:10:40 +0ms service=session.prompt session=ses_606691b9cffeudEbIegvHWl05t type=start-step part INFO 2025-10-18T23:10:40 +2ms service=bus type=message.part.updated publishing INFO 2025-10-18T23:10:40 +18ms service=snapshot initialized INFO 2025-10-18T23:10:40 +151ms service=snapshot hash=d9401cc1427b8890c5c61de75030a5d3385c406d cwd=/Users/sage/.config/nixos git=/Users/sage/.local/share/opencode/snapshot/89f34abaaf3f1e37f8ed37aff0273e2e780127e1 tracking INFO 2025-10-18T23:10:40 +0ms service=session.prompt session=ses_606691b9cffeudEbIegvHWl05t type=error part ERROR 2025-10-18T23:10:40 +1ms service=session.prompt session=ses_606691b9cffeudEbIegvHWl05t error=The number of tokens to keep from the initial prompt is greater than the context length. Try to load the model with a larger context length, or provide a shorter input process INFO 2025-10-18T23:10:40 +1ms service=bus type=message.updated publishing INFO 2025-10-18T23:10:40 +0ms service=session.prompt session=ses_606691b9cffeudEbIegvHWl05t sessionID=ses_606691b9cffeudEbIegvHWl05t unlocking ERROR 2025-10-18T23:10:40 +0ms service=server error="The number of tokens to keep from the initial prompt is greater than the context length. Try to load the model with a larger context length, or provide a shorter input" is not an Object. (evaluating '"name" in input') failed INFO 2025-10-18T23:10:40 +0ms service=server duration=900 response INFO 2025-10-18T23:10:40 +0ms service=bus type=session.idle publishing ERROR 2025-10-18T23:10:40 +1ms service=tui failed to send message: POST "http://127.0.0.1:51738/session/ses_606691b9cffeudEbIegvHWl05t/message": 400 Bad Request {"name":"UnknownError","data":{"message":"TypeError: \"The number of tokens to keep from the initial prompt is greater than the context length. Try to load the model with a larger context length, or provide a shorter input\" is not an Object. (evaluating '\"name\" in input')\n at isInstance (/$bunfs/root/opencode:64186:26)\n at process (/$bunfs/root/opencode:104913:56)\n at processTicksAndRejections (native:7:39)"}} INFO 2025-10-18T23:10:42 +2092ms service=bus type=* unsubscribing INFO 2025-10-18T23:10:42 +0ms service=server event disconnected ``` </details> Is this potentially related, or should I open a new issue?
Author
Owner

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

thats a different thing but it looks like your model doesnt have enough context? Ig open a new issue and we can discuss further

@rekram1-node commented on GitHub (Oct 18, 2025): thats a different thing but it looks like your model doesnt have enough context? Ig open a new issue and we can discuss further
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#1620