Skip to content

Reset detection cache when tokscale binary disappears - #4

Merged
stevejkang merged 1 commit into
mainfrom
fix/reset-detection-cache-on-enoent
Aug 18, 2026
Merged

stevejkang merged 1 commit into
mainfrom
fix/reset-detection-cache-on-enoent

Conversation

@stevejkang

@stevejkang stevejkang commented Aug 18, 2026 •

Copy link
Copy Markdown
Owner

Problem

When tokscale is cached as "installed" but the binary is later removed (or was never fully set up), fetchPeriodStats fails with ENOENT. The detection cache still reports installed=true, so the sidebar shows a persistent "err" instead of the install prompt.

Fix

  • tokscale.ts: Detect ENOENT in fetchPeriodStats error handler → call resetDetectionCache() and throw TokscaleNotFoundError
  • tui.tsx: Catch TokscaleNotFoundError → set installed(false) and transition all periods to "not-installed" state

This ensures the sidebar falls back to the install prompt (Install: npm i -g @tokscale/cli) instead of showing an opaque "err".

When fetchPeriodStats receives ENOENT from execFile, the tokscale
binary was removed after initial detection. Previously this surfaced
as a persistent "err" in the sidebar because the cached detection
still reported installed=true.

Now ENOENT resets the detection cache and throws TokscaleNotFoundError,
which tui.tsx catches to transition all periods to "not-installed" —
showing the install prompt instead of an opaque error.
@stevejkang
stevejkang merged commit 1734a42 into main Aug 18, 2026
1 check passed
@stevejkang
stevejkang deleted the fix/reset-detection-cache-on-enoent branch September 7, 2026 00:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant