-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Description
App Version
v3.25.6
API Provider
Not Applicable / Other
Model Used
N/A
π Steps to Reproduce
- Start VSCode instance without starting docker qdrant instance
- Get
Error - Failed during initial scan: fetch failederror in code indexing popup. This is not the bug, this is normal behaviour - Start up docker qdrant instance
- Press "Start Indexing", "Error - Failed during initial scan: fetch failed" error persists
- Reload developer window and indexing starts automatically as it should
π₯ Outcome Summary
Expected "Start Indexing" button to retry connection and start indexing once Qdrant is available, but got persistent error state requiring developer window reload.
π Relevant Logs or Errors (Optional)
Error - Failed during initial scan: fetch failed
π Comprehensive Issue Scoping
Root Cause / Implementation Target
The CodeIndexManager enters an error state when Qdrant is unavailable during initial validation. When the user clicks "Start Indexing" after Qdrant becomes available, the system doesn't clear this error state before attempting to reinitialize, causing the operation to fail.
Affected Components
-
Primary Files:
src/core/webview/webviewMessageHandler.ts(lines 2183-2212): Handles the "startIndexing" message from UIsrc/services/code-index/manager.ts(lines 108-156, 223-298): Contains initialization logic and error state management
-
Secondary Impact:
src/services/code-index/state-manager.ts: Manages the system statesrc/services/code-index/__tests__/manager.spec.ts: Tests need updating
Current Implementation Analysis
The function at line 273 in manager.ts sets error state when validation fails:
this._stateManager.setSystemState("Error", errorMessage)But when "Start Indexing" is clicked (webviewMessageHandler.ts line 2202-2204), it only checks if manager is initialized, not if it's in error state.
Proposed Implementation
Step 1: Add error recovery method to CodeIndexManager
- File:
src/services/code-index/manager.ts - Add new method after line 180:
public async recoverFromError(): Promise<void> {
// Clear error state
this._stateManager.setSystemState("Standby", "")
// Force re-initialization
this._configManager = undefined
this._serviceFactory = undefined
this._orchestrator = undefined
this._searchService = undefined
}Step 2: Update startIndexing handler
- File:
src/core/webview/webviewMessageHandler.ts - Modify lines 2200-2206 to check for error state:
if (manager.isFeatureEnabled && manager.isFeatureConfigured) {
// Check if in error state and recover
const currentStatus = manager.getCurrentStatus()
if (currentStatus.systemStatus === "Error") {
await manager.recoverFromError()
}
if (!manager.isInitialized) {
await manager.initialize(provider.contextProxy)
}
manager.startIndexing()
}Testing Requirements
- Unit Tests:
- Test case 1: Verify recoverFromError clears error state
- Test case 2: Verify startIndexing recovers from error state
- Edge Cases:
- Edge case 1: Multiple rapid clicks on "Start Indexing"
- Edge case 2: Qdrant becomes unavailable during recovery
Performance Impact
- Expected performance change: Neutral
- Benchmarking needed: No
- Optimization opportunities: None identified
Security Considerations
- Input validation requirements: None (existing validation sufficient)
- Authentication/Authorization changes: None
- Data exposure risks: None
Migration Strategy
Not applicable - this is a bug fix with no data migration needed.
Rollback Plan
If issues arise, revert the two file changes. No data or configuration changes are involved.
Dependencies and Breaking Changes
- External dependencies affected: None
- API contract changes: None (new method is internal)
- Breaking changes for users: None
Metadata
Metadata
Assignees
Labels
Type
Projects
Status