-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Description
App Version
3.19.4
API Provider
OpenAI
Model Used
text-embeddings-large-3
π Steps to Reproduce
I setup Qdrant and tried to enable codebase indexing but am getting this error immediately and not sure what's going on.
Error - Failed during initial scan: path should be a `path.relative()`d string, but got "../admin/.prettierrc.json"
π₯ Outcome Summary
I would expect at least more details about what's wrong, or a way to fix it. I'm stuck :(
π Relevant Logs or Errors (Optional)
Error - Failed during initial scan: path should be a `path.relative()`d string, but got "../admin/.prettierrc.json"π― Scope
Root Cause: Workspace path inconsistency in multi-workspace VSCode scenarios. The list_files tool resolves paths relative to cline.cwd (command initiation workspace), while the code indexing system uses getWorkspacePath() which returns the workspace of the currently active file in the editor.
Error Origin: The error "path should be a path.relative()d string" originates from the 'ignore' library used for .gitignore-style pattern matching when it receives improperly formatted paths during path transformation.
Key Components Involved:
- Path Resolution:
src/utils/path.ts-getWorkspacePath()function causing inconsistency - Path Transformation:
src/services/code-index/shared/get-relative-path.ts- Path normalization utilities - File Scanning:
src/services/code-index/scanner.ts- Where path transformations occur during indexing - File Listing:
src/core/tools/listFilesTool.ts- Entry point for file discovery
Failure Scenario:
- User initiates indexing from workspace A
- Active file in editor is from workspace B
list_filesreturns paths relative to workspace A- Code indexing tries to process them relative to workspace B
- Path transformation functions fail β "relative path" error
Solution Approach:
- Primary Fix: Ensure consistent workspace resolution by passing workspace context explicitly through the indexing pipeline
- Secondary: Add robust path normalization that handles cross-workspace scenarios
- Testing: Add comprehensive multi-workspace test scenarios
Files to Modify:
src/utils/path.ts- ImprovegetWorkspacePath()consistencysrc/services/code-index/shared/get-relative-path.ts- Add workspace contextsrc/services/code-index/scanner.ts- Handle multi-workspace pathssrc/core/tools/listFilesTool.ts- Pass workspace context
Out of Scope: No need to modify every service around code-based indexing - focus on fixing the workspace path resolution at the source rather than patching downstream consumers.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status