Skip to content

fix: improve error handling in CLI status command#34

Merged
graydawnc merged 1 commit intomainfrom
fix/cli-status-error-handling
Apr 3, 2026
Merged

fix: improve error handling in CLI status command#34
graydawnc merged 1 commit intomainfrom
fix/cli-status-error-handling

Conversation

@graydawnc
Copy link
Copy Markdown
Collaborator

@graydawnc graydawnc commented Apr 3, 2026

Summary

The spool status catch block was swallowing all exceptions and displaying "No index found. Run spool sync to create it." regardless of the actual error, masking real issues behind a misleading message.

Problem

When better-sqlite3's NODE_MODULE_VERSION doesn't match the current Node version, getDB() throws ERR_DLOPEN_FAILED. The catch block treated this as a missing database:

$ spool status
No index found. Run `spool sync` to create it.

In reality, ~/.spool/spool.db existed with 47.5MB of data (340+ sessions). The actual problem was a native module version mismatch that the user never got to see.

Fix

  • Only show "No index found" when the error is SQLITE_CANTOPEN (database truly doesn't exist)
  • Surface all other errors with the actual message and a non-zero exit code

Test plan

  • spool status displays index info correctly when DB exists
  • Native module errors now show the real error message instead of "No index found"
  • Other commands (search, list, show, sync, sources) verified working

Submitted by: @graydawnc

🤖 Generated with Claude Code

The catch block was swallowing all exceptions and showing "No index found"
regardless of the actual error. This masked real issues like native module
version mismatches (better-sqlite3 NODE_MODULE_VERSION), making them appear
as if the database simply didn't exist.

Now only SQLITE_CANTOPEN triggers the "no index" message. All other errors
are surfaced with the actual error message and a non-zero exit code.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@graydawnc graydawnc merged commit 3041832 into main Apr 3, 2026
3 checks passed
@graydawnc graydawnc deleted the fix/cli-status-error-handling branch April 3, 2026 08:21
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