Skip to content

Error during codebase indexing about relative pathΒ #4397

@tmchow

Description

@tmchow

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:

Failure Scenario:

  1. User initiates indexing from workspace A
  2. Active file in editor is from workspace B
  3. list_files returns paths relative to workspace A
  4. Code indexing tries to process them relative to workspace B
  5. 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:

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

Issue - In ProgressSomeone is actively working on this. Should link to a PR soon.bugSomething isn't working

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions