Skip to content

1.17.1 TUI exits with Unexpected server error when started from large home directory #31701

Closed as not planned

Description

@JosXa

Summary

OpenCode 1.17.1 TUI exits shortly after rendering the home prompt when started from a large home directory. The terminal shows only:

Error: Unexpected server error. Check server logs for details.
    at <anonymous> (/$bunfs/root/chunk-j3wpssn9.js:8:7615)
    at processTicksAndRejections (native:7:39)

Downgrading to 1.17.0 fixes the crash.

Reproduction

Environment:

  • macOS / darwin arm64
  • OpenCode 1.17.1 installed via bun
  • Start directory is the user's home directory (/Users/joscha), which is large and contains many project directories

Steps:

cd ~
opencode --print-logs

Observed: TUI renders the initial prompt, then exits with Unexpected server error after a few seconds.

Expected: TUI should remain open, or at minimum a file-search/indexing failure should not crash the TUI.

Log evidence

With 1.17.1, startup from ~ repeatedly logs server defects like:

timestamp=2026-06-10T14:29:00.949Z level=ERROR run=108389c9 message=failed ref=err_dc6a4eb1 error="fff scan timed out" cause="Error: fff scan timed out\n    at KU (/$bunfs/root/chunk-kxc6dk47.js:12:2852)"
timestamp=2026-06-10T14:29:00.949Z level=ERROR run=108389c9 message=failed ref=err_adf6278e error="fff scan timed out" cause="Error: fff scan timed out\n    at KU (/$bunfs/root/chunk-kxc6dk47.js:12:2852)"

Disabling external TUI plugins does not fix it. Running with --pure still crashes. Setting OPENCODE_DISABLE_FFF=1 also did not prevent the TUI exit in my local repro.

Downgrading fixes it:

opencode upgrade 1.17.0
cd ~
opencode

The same home-directory TUI stays open on 1.17.0.

Suspected regression

The relevant 1.17.0 -> 1.17.1 change appears to be in packages/opencode/src/agent/agent.ts.

1.17.1 added reference directory expansion while constructing agent permissions:

const referenceDirs = yield* Effect.gen(function* () {
  yield* (yield* PluginBoot.Service).wait()
  return (yield* (yield* Reference.Service).list()).map((reference) => reference.path)
}).pipe(Effect.provide(locations.get(Location.Ref.make({ directory: AbsolutePath.make(ctx.directory) }))))

That means the /agent path now boots a LocationServiceMap for the current directory. From ~, this initializes location services and file search/indexing over the home directory. On a large home directory, this can produce fff scan timed out, which the HTTP error middleware converts into a generic 500. The TUI client then exits with Unexpected server error.

Why this matters

Starting OpenCode from $HOME is a normal workflow. A slow or failing file index should be degraded or isolated, not make the whole TUI exit.

Possible fixes might be:

  • avoid doing reference-dir expansion on /agent hot path unless needed
  • do not bootstrap full location file-search services just to list reference paths
  • treat fff scan timed out in file/autocomplete/agent-reference contexts as recoverable
  • ensure OPENCODE_DISABLE_FFF=1 avoids this crash path

Activity

  1. github-actions commented on Jun 10, 2026

    @github-actions
    Contributor

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

  2. JosXa commented on Jun 10, 2026

    @JosXa
    ContributorAuthor

    Closing as a duplicate of #31682. The bot correctly identified it, and #31682 is already closed by a maintainer as fixed in an upcoming release.

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