Skip to content

Conversation

@daniel-lxs
Copy link
Member

@daniel-lxs daniel-lxs commented Jul 10, 2025

Description

Fixes #5562

This PR improves error handling when switching between embedding models with different vector dimensions in the Qdrant vector store. Previously, users would encounter unclear errors when the vector dimensions didn't match. Now, the system attempts to recreate the collection with the new dimensions and provides a clear, internationalized error message if the operation fails.

Changes Made

  • Enhanced error handling in qdrant-client.ts to detect vector dimension mismatches during collection recreation
  • Added logic to attempt deletion and recreation of the collection when dimensions change
  • Implemented internationalized error messages using the key embeddings:vectorStore.vectorDimensionMismatch
  • Updated error handling to preserve specific error types instead of wrapping them in generic errors
  • Added comprehensive test coverage for dimension mismatch scenarios

Testing

  • All existing tests pass
  • Added new test cases in qdrant-client.spec.ts for:
    • Vector dimension mismatch detection
    • Collection recreation on dimension change
    • Proper error message display
  • Manual testing completed:
    • Verified error handling when switching between models with different dimensions
    • Confirmed internationalized error messages display correctly

Verification of Acceptance Criteria

  • Clear error message when vector dimensions don't match
  • Automatic attempt to recreate collection with new dimensions
  • Proper error handling if recreation fails
  • All error messages are internationalized
  • No breaking changes to existing functionality

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • Comments added for complex logic
  • Documentation updated (error messages)
  • No breaking changes
  • All tests passing
  • Internationalization complete for all supported languages

Files Changed

  • src/services/code-index/vector-store/qdrant-client.ts - Enhanced error handling for dimension mismatches
  • src/services/code-index/vector-store/__tests__/qdrant-client.spec.ts - Added comprehensive test coverage
  • src/i18n/locales/*/embeddings.json - Added new error message translations for all supported languages

Important

Enhances error handling for Qdrant vector dimension mismatches, adds internationalized error messages, and updates tests.

  • Behavior:
    • Enhanced error handling in qdrant-client.ts for vector dimension mismatches during collection recreation.
    • Attempts to delete and recreate collection if dimensions change.
    • Throws vectorDimensionMismatch error with original error as cause if recreation fails.
    • Logs errors and warnings appropriately.
  • Internationalization:
    • Added vectorDimensionMismatch error message to embeddings.json in multiple locales.
  • Testing:
    • Added tests in qdrant-client.spec.ts for dimension mismatch detection and error handling.
    • Tests cover scenarios where collection recreation fails due to delete or create errors.

This description was created by Ellipsis for 8903a7b. You can customize this summary. It will automatically update as commits are pushed.

… models (#5562)

- Added specific error handling for vector dimension mismatches
- Attempt to delete and recreate collection when dimensions change
- Provide clear, internationalized error message if recreation fails
- Added comprehensive test coverage for dimension mismatch scenarios
- Updated all locale files with new error message translations
@daniel-lxs daniel-lxs requested review from cte, jr and mrubens as code owners July 10, 2025 14:51
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Jul 10, 2025
@dosubot dosubot bot added bug Something isn't working documentation Improvements or additions to documentation labels Jul 10, 2025
@delve-auditor
Copy link

delve-auditor bot commented Jul 10, 2025

No security or compliance issues detected. Reviewed everything up to 8903a7b.

Security Overview
  • 🔎 Scanned files: 20 changed file(s)
Detected Code Changes
Change Type Relevant files
Enhancement ► embeddings.json
    Add vector dimension mismatch error messages for all locales
► qdrant-client.ts
    Improve error handling for vector dimension mismatches
► qdrant-client.spec.ts
    Add tests for vector dimension mismatch scenarios

Reply to this PR with @delve-auditor followed by a description of what change you want and we'll auto-submit a change to this PR to implement it.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Jul 10, 2025
@daniel-lxs daniel-lxs moved this from Triage to PR [Draft / In Progress] in Roo Code Roadmap Jul 10, 2025
- Use error.cause instead of string matching for vector dimension mismatch errors
- Fix interpolation syntax in all translation files (single to double curly braces)
- Update tests to check for error.cause property
@daniel-lxs daniel-lxs force-pushed the fix/issue-5562-qdrant-vector-dimension-mismatch branch from d66c0fc to 8903a7b Compare July 10, 2025 15:11
@hannesrudolph hannesrudolph added PR - Draft / In Progress and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Jul 10, 2025
@daniel-lxs daniel-lxs moved this from PR [Draft / In Progress] to PR [Needs Review] in Roo Code Roadmap Jul 10, 2025
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jul 10, 2025
@mrubens mrubens merged commit 97b917e into main Jul 10, 2025
14 checks passed
@mrubens mrubens deleted the fix/issue-5562-qdrant-vector-dimension-mismatch branch July 10, 2025 15:29
@github-project-automation github-project-automation bot moved this from PR [Needs Review] to Done in Roo Code Roadmap Jul 10, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Jul 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation lgtm This PR has been approved by a maintainer PR - Draft / In Progress size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Vector dimension for code index only accepts 1536

4 participants