fix(mcp): drop unreachable throw in setTimeout-wrapped initial sync#318
Merged
zc277584121 merged 1 commit intoApr 24, 2026
Merged
Conversation
The throw inside an async setTimeout callback has no caller to propagate to, so unexpected errors during the 5s-deferred initial sync are silently lost anyway. The preceding console.error already covers observability. Fixes zilliztech#256
Contributor
Author
|
Appreciate getting the dead-code path out of the initial sync. |
lufftw
pushed a commit
to lufftw/claude-context
that referenced
this pull request
May 8, 2026
…illiztech#318) Remove throw in setTimeout callback that would crash the MCP server process on unexpected background sync errors. The error is already logged via console.error, and the periodic sync will retry on the next cycle.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Drops a
throw errorinside the initial-syncsetTimeoutcallback inpackages/mcp/src/sync.ts. The callback runs with no caller, so the throw has nowhere to propagate. The precedingconsole.error(...)is the terminal signal for unexpected failures.Why this matters
Reporter in #256 called out the bug with an exact file:line pointer. Unexpected errors during the 5s-deferred initial sync are silently lost today, not surfaced. This is a pure log-and-continue fix.
Changes
} else { console.error('[SYNC-DEBUG] Initial sync failed with unexpected error:', error); - throw error; + // Do not re-throw here: this callback runs via setTimeout with no caller to propagate to. }No other changes. No behavior regression: the throw was already unreachable.
Testing
pnpm install --frozen-lockfile && pnpm buildpasses locally on Node 22.Related sync.ts PRs
Aware of #314, #274, #268, #234 also touching
packages/mcp/src/sync.ts. None of them address the setTimeout throw (#314 preserves it at the relocated line). Whichever lands first, the other rebases cleanly.Fixes #256