Skip to content

TUI fails to load on Windows #8

@freelanceagent1

Description

@freelanceagent1

Short description

@cortexkit/aft-opencode loads as an OpenCode plugin, but its TUI layer fails during startup on Windows. Thi

What happened?

@cortexkit/aft-opencode loads as an OpenCode plugin, but its TUI layer fails during startup on
Windows. This adds noticeable startup delay and makes /aft-status unreliable or misleading.

This does not appear to be a config issue:

  • AFT config is present
  • doctor reports the config as loaded correctly
  • binary cache resolves successfully

The failures appear to be:

  1. a TUI packaging/export issue where the exported TUI source imports .js files that are not present
    in the shipped source tree
  2. a Windows path normalization issue where internal LSP startup fails on \?\C:... workspace roots

Environment

  • OS: Windows
  • OpenCode: 1.4.3
  • AFT package observed: 0.11.5, then refreshed to 0.12.0
  • Repo/workspace example:
    • C:\Users\user\Desktop\reponame\repo

Config

AFT config file:

  • C:\Users\user.config\opencode\aft.json

Contents:

{
"format_on_edit": true,
"experimental_search_index": true,
"experimental_semantic_search": true,
"validate_on_edit": "syntax",
"restrict_to_project_root": true
}

AFT doctor reports this as loaded correctly.

Repro

  1. Install/use @cortexkit/aft-opencode@latest in OpenCode
  2. Restart OpenCode on Windows
  3. Watch OpenCode console / plugin startup logs
  4. Trigger or observe AFT TUI load (aft-status / TUI plugin path)

Actual behavior

OpenCode console shows:

[tui.plugin] failed to load tui plugin: ENOENT: no such file or directory, open
'C:\Users\user.cache\opencode\packages@cortexkit\aft-
opencode@latest\node_modules@cortexkit\aft-opencode\src\shared\rpc-utils.js'

Relevant files in installed package:

  • TUI entry:
    • .../node_modules/@cortexkit/aft-opencode/src/tui/index.tsx
  • shared client:
    • .../node_modules/@cortexkit/aft-opencode/src/shared/rpc-client.ts
  • actual source present:
    • .../node_modules/@cortexkit/aft-opencode/src/shared/rpc-utils.ts

Observed import mismatch:

  • rpc-client.ts imports ./rpc-utils.js
  • but only rpc-utils.ts exists in shipped src/shared

Package export points TUI to source:

"./tui": {
"types": "./src/tui/index.tsx",
"import": "./src/tui/index.tsx"
}

This suggests the TUI export is loading raw source that expects .js sibling files which are not
shipped.

Expected behavior

  • AFT TUI loads successfully
  • /aft-status reflects live feature flags and index state
  • no missing-file ENOENT during plugin startup
  • doctor should catch broken runtime if TUI cannot load

Additional issue: Windows \?\ path handling

AFT plugin log repeatedly shows:

[aft-lsp] failed to spawn TypeScript Language Server:
not found: failed to convert workspace root '\?\C:\Users\user\Desktop\repo\repo' to
file URI

This looks like a separate Windows bug:

  • AFT/LSP path handling rejects extended-length \?\ paths
  • even when the binary is running, LSP-backed functionality is degraded

Why this is confusing

doctor says everything is healthy:

  • config loaded
  • binary cache active
  • “Everything looks good”

But live runtime still has:

  • broken TUI load
  • misleading status behavior
  • LSP spawn/path failures

So doctor currently misses actual runtime breakage.

Suggested areas to inspect

  1. TUI packaging/export
  • avoid exporting raw src/tui/index.tsx if it imports .js siblings that are not shipped
  • either export compiled TUI artifact or ensure shipped source/import graph is self-consistent
  1. Windows path normalization
  • normalize \?\C:... before file-URI conversion for LSP startup
  1. Doctor coverage
  • verify TUI entry loadability
  • verify live RPC health
  • verify LSP startup against the current workspace root
  • not just config presence and binary resolution
  1. Attempted to workaround
  • Attempting to remove the AFT TUI entry from tui.json is not a stable workaround.
  • On OpenCode launch, AFT automatically re-adds itself to:
    • C:\Users\G15Advantage.config\opencode\tui.json
  • This appears to happen via ensureTuiPluginEntry() inside the plugin startup path.
  • So any workaround that depends on manually removing the TUI plugin entry does not persist across
    launches.

Diagnostics

Plugin version

0.12.0

AFT binary version

0.12.0

Platform

win11

Log output (optional)

above

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions