Skip to content

TUI shows blank page when ~/Library contains large number of files #27071

Closed as not planned

Description

@litown

Environment

  • opencode: v1.14.48
  • OS: macOS 15.4.1 (Build 24E263), Apple Silicon (arm64)
  • Terminal: Ghostty 1.3.2 / Terminal.app / iTerm2 (all affected)
  • Shell: zsh 5.9
  • Install method: npm (npm i -g opencode-ai)

Problem

TUI always shows a completely blank page after launch. Backend (opencode serve) works correctly with proper API responses. The issue persists across ALL terminal emulators.

Root Cause

Bun runtime scans ~/Library directory during initialization. My ~/Library contains millions of files (WPS Office PDF caches, Claude session data, JetBrains caches, etc.) with paths up to 453 characters long. This scanning blocks the TUI rendering thread, resulting in a blank page.

Colleagues with identical hardware/software do NOT have this issue — their ~/Library directories have far fewer files.

Reproduction

  1. Have a macOS system with a large ~/Library directory (millions of files)
  2. Run opencode in any terminal
  3. Observe blank TUI
  4. Backend logs show 3x ENAMETOOLONG: name too long, open rejection

Workaround

Set HOME to a minimal isolated directory before launching:

export HOME="/path/to/minimal/home"
opencode

Log Evidence

INFO  service=file.watcher init
ERROR service=default e=ENAMETOOLONG: name too long, open rejection
ERROR service=default e=ENAMETOOLONG: name too long, open rejection
ERROR service=default e=ENAMETOOLONG: name too long, open rejection
ERROR service=default e=EIO: i/o error, read exception
ERROR service=default e=setRawMode failed with errno: 9 exception

Suggested Fix

  • Avoid scanning ~/Library during TUI initialization
  • Add timeout for file scanning operations to prevent blocking the render loop
  • Handle ENAMETOOLONG gracefully instead of crashing TUI

Activity

  1. github-actions commented on May 12, 2026

    @github-actions
    Contributor

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

  2. sachanritik1 commented on Jul 9, 2026

    @sachanritik1

    Additional report (macOS 26.5, opencode 1.17.17)

    Hit the same blank TUI on a fresh Homebrew install (anomalyco/tap/opencode 1.17.17).

    Environment

    • OS: macOS 26.5.2 (Darwin 25.5.0, arm64)
    • Install: Homebrew (/opt/homebrew/bin/opencode)
    • Terminal: standard macOS terminal (also reproducible in non-TTY environments)

    Symptoms

    • Running opencode → blank screen, no UI, appears hung
    • opencode run and TUI mode hang at init in logs
    • opencode serve starts fine (headless works)
    • opencode models, opencode debug config work without full instance init

    ~/Library size

    • ~45 GB and ~650k files when the bug occurred
    • After cleanup (removed Android SDK, unused app data, etc.) still ~27 GB — issue was present before and after cleanup

    Logs

    Logs stop at init, then (when run with a PTY) ENAMETOOLONG: name too long, open during directory walk — consistent with file watcher / home-dir scanning blocking startup.

    Workaround (confirmed working)

    Launch with a minimal HOME and symlink real config/data paths:

    REAL_HOME="$HOME"
    MINIMAL_HOME="${TMPDIR:-/tmp}/opencode-minimal-home-${USER}"
    mkdir -p "$MINIMAL_HOME"/{.config,.local/share,.local/state,.cache}
    ln -sf "$REAL_HOME/.config/opencode" "$MINIMAL_HOME/.config/opencode"
    ln -sf "$REAL_HOME/.local/share/opencode" "$MINIMAL_HOME/.local/share/opencode"
    ln -sf "$REAL_HOME/.local/state/opencode" "$MINIMAL_HOME/.local/state/opencode"
    ln -sf "$REAL_HOME/.cache/opencode" "$MINIMAL_HOME/.cache/opencode"
    export HOME="$MINIMAL_HOME"
    exec /opt/homebrew/bin/opencode "$@"

    With this wrapper, TUI starts normally and opencode run completes successfully.

    What did NOT help

    • OPENCODE_DISABLE_DEFAULT_PLUGINS=1
    • OPENCODE_EXPERIMENTAL_DISABLE_FILEWATCHER=true
    • Clearing ~/.cache/opencode and ~/.local/share/opencode
    • --pure flag

    Happy to provide more logs or test a fix build if useful.

  3. github-actions commented on Sep 8, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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