opencode icon indicating copy to clipboard operation
opencode copied to clipboard

black screen when using >1.0.46

Open wolfie82 opened this issue 2 months ago • 16 comments

Description

Upgraded to opencode 1.0.47. When launching opencode I just see a black screen and the tui doesn't load. The issue is resolved by reverting to 1.0.46.

I have to kill the process manually.

OpenCode version

1.0.47

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

macOS 15.7

Terminal

iTerm2

wolfie82 avatar Nov 09 '25 19:11 wolfie82

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

  • #3853: Black screen when running opencode web - similar black screen symptom on macOS with version-specific issue
  • #3776: Screen becomes completely blank - TUI becomes blank during sessions on macOS
  • #3935: Unstable TUI - reports disappearing content area and UI instability since v1.0 on macOS
  • #3671: 1.0+ is unusable in non-truecolor terminal - UI problems specifically starting with v1.0+ on macOS
  • #4043: TUI themes became dim - visual display issues in v1.0.39 on macOS

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

github-actions[bot] avatar Nov 09 '25 19:11 github-actions[bot]

Image

I don't use iterm normally but I can't replicate...

Do u have any special custom themes or anything?

rekram1-node avatar Nov 09 '25 19:11 rekram1-node

I was able to run the issue down.

Root Cause: Silent Plugin Initialization Failure in OpenCode v1.0.47+

The Breaking Change Commit 4bb7ea91 (Nov 8, 2025) - "improve startup speed" changed how OpenCode initializes plugins:

Before (v1.0.46): const cache = new Map<string, Context>()

  • Plugins initialized AFTER instance setup was complete
  • Errors during plugin init were visible/recoverable

After (v1.0.47+): const cache = new Map<string, Promise<Context>>()

  • Plugins initialized INSIDE a cached Promise
  • If ANY plugin throws/hangs during init, entire Promise fails
  • OpenCode shows black screen with NO error messages

What Caused the Failure

export const DynamicContextLoaderPlugin: Plugin = async ({ client, ... }) => {
  await client.app.log({  // ← THIS LINE FAILED
    body: {
      service: 'dynamic-context-loader',
      level: 'info',
      message: `🔌 Plugin initialized`,
    },
  })
  return { ... }
}

Why await client.app.log() failed during init:

  • The OpenCode app/server wasn't fully ready yet during plugin initialization
  • The client.app.log() call either threw an error or hung waiting for a response
  • Since this happened inside the cached Promise, OpenCode failed silently
  • Result: Black screen, no error messages, no way to debug

The Fix

Don't use await client.app.log() (or any async calls to client) during plugin initialization:

export const DynamicContextLoaderPlugin: Plugin = async ({ client, ... }) => {
  // Just initialize and return immediately - no await calls
  const manager = ContextLoaderManager.getInstance(projectPath)
  
  return {
    // Logging works fine HERE (after initialization)
    event: async ({ event }) => {
      await client.app.log({ ... })  // ✅ This is fine
    }
  }
}

wolfie82 avatar Nov 09 '25 20:11 wolfie82

nice job tracking it down we will fix this

rekram1-node avatar Nov 09 '25 20:11 rekram1-node

appeared past version 1.1.14 to me, updated to 1.1.16, 1.1.17 and 1.1.18 and it still persist, desktop app works fine OS: ubuntu server

Rhiz3K avatar Jan 13 '26 18:01 Rhiz3K

Just started opencode for the first time; blank terminal. MacOS 15.7.3, iTerm2 3.6.6, zsh. In this state, there is no response to any keyboard inputs anymore and I need to close the entire tab.

Alternative approaches I tried

Desktop app

Never gets past the "Initializing ..." screen.

CLI v1.0.46

No blank screen, but also no output whatsoever for command opencode

serve

For both v1.0.46 and v 1.1.19, opencode serve -print-logs --log-level DEBUG starts a web server and logs incoming GET requests when trying to open http://127.0.0.1:4096 in browser, but requests never finish; there is just no HTTP response.

Logs

I have bun installed via nvm, not sure if this could be an issue:

show/hide

➜ ~ opencode run hello --print-logs

INFO 2026-01-14T11:41:19 +285ms service=default version=1.1.19 args=["run","hello","--print-logs"] opencode INFO 2026-01-14T11:41:19 +0ms service=default directory=/Users/myusername creating instance INFO 2026-01-14T11:41:19 +0ms service=project directory=/Users/myusername fromDirectory INFO 2026-01-14T11:41:19 +8ms service=default directory=/Users/myusername bootstrapping INFO 2026-01-14T11:41:19 +1ms service=config path=/Users/myusername/.config/opencode/config.json loading INFO 2026-01-14T11:41:19 +0ms service=config path=/Users/myusername/.config/opencode/opencode.json loading INFO 2026-01-14T11:41:19 +0ms service=config path=/Users/myusername/.config/opencode/opencode.jsonc loading INFO 2026-01-14T11:41:19 +1ms service=bun cmd=["/Users/myusername/.opencode/bin/opencode","add","@opencode-ai/[email protected]","--exact"] cwd=/Users/myusername/.config/opencode running INFO 2026-01-14T11:41:19 +2ms service=config path=/Users/myusername/.opencode/opencode.jsonc loading INFO 2026-01-14T11:41:19 +0ms service=config path=/Users/myusername/.opencode/opencode.json loading INFO 2026-01-14T11:41:19 +0ms service=bun cmd=["/Users/myusername/.opencode/bin/opencode","add","@opencode-ai/[email protected]","--exact"] cwd=/Users/myusername/.opencode running INFO 2026-01-14T11:41:19 +6ms service=plugin name=CodexAuthPlugin loading internal plugin INFO 2026-01-14T11:41:19 +0ms service=plugin [email protected] loading plugin INFO 2026-01-14T11:41:19 +6ms service=plugin [email protected] loading plugin INFO 2026-01-14T11:41:19 +0ms service=bun code=0 stdout=bun add v1.3.5 (1e86cebd)

installed @opencode-ai/[email protected]

[7.00ms] done stderr=Saved lockfile done INFO 2026-01-14T11:41:19 +0ms service=bun cmd=["/Users/myusername/.opencode/bin/opencode","install"] cwd=/Users/myusername/.config/opencode running INFO 2026-01-14T11:41:19 +1ms service=bun code=0 stdout=bun add v1.3.5 (1e86cebd)

installed @opencode-ai/[email protected]

[6.00ms] done stderr=Saved lockfile done INFO 2026-01-14T11:41:19 +0ms service=bun cmd=["/Users/myusername/.opencode/bin/opencode","install"] cwd=/Users/myusername/.opencode running INFO 2026-01-14T11:41:19 +21ms service=plugin path=@gitlab/[email protected] loading plugin INFO 2026-01-14T11:41:19 +1ms service=bun code=0 stdout=bun install v1.3.5 (1e86cebd)

Checked 3 installs across 4 packages (no changes) [1.00ms] stderr= done INFO 2026-01-14T11:41:19 +0ms service=bun code=0 stdout=bun install v1.3.5 (1e86cebd)

Checked 3 installs across 4 packages (no changes) [1.00ms] stderr= done INFO 2026-01-14T11:41:19 +1ms service=bun pkg=@gitlab/opencode-gitlab-auth version=1.3.0 installing package using Bun's default registry resolution INFO 2026-01-14T11:41:19 +0ms service=bun cmd=["/Users/myusername/.opencode/bin/opencode","add","--force","--exact","--cwd","/Users/myusername/.cache/opencode","@gitlab/[email protected]"] cwd=/Users/myusername/.cache/opencode running

stefan-girlich avatar Jan 14 '26 10:01 stefan-girlich