Skip to content

fix: KeyError 'pq' when updating the quantizer on an HFresh vector index - #2147

Merged
Shah91n merged 1 commit into
mainfrom
fix/hfresh-quantizer-update-keyerror
Aug 24, 2026
Merged

fix: KeyError 'pq' when updating the quantizer on an HFresh vector index#2147
Shah91n merged 1 commit into
mainfrom
fix/hfresh-quantizer-update-keyerror

Conversation

@Shah91n

@Shah91n Shah91n commented Aug 24, 2026

Copy link
Copy Markdown
Member

You can't change the RQ settings on an HFresh index. Trying to update rq.rescore_limit fails straight away with KeyError: 'pq', before the client even talks to the server. The docs say this setting can be changed at runtime, and the server does accept it if you edit the schema directly, so this is a client-side bug.

The cause is in the check that stops you from switching quantizers. When you ask to update RQ, the client first looks at whether PQ, BQ or SQ are currently switched on, since swapping quantizer types means recreating the collection. That check assumes every index has all four quantizer blocks in its schema, which is true for HNSW. HFresh always uses RQ, so its schema only has an rq block, and looking up pq throws.

Adds tests covering the HFresh case, which fail without the fix, plus one pinning that switching quantizers on HNSW is still rejected. Verified against Weaviate 1.38.7, where rq.rescore_limit now updates as expected.

@Shah91n Shah91n self-assigned this Aug 24, 2026
Copilot AI lite review requested due to automatic review settings August 24, 2026 09:44

@orca-security-eu orca-security-eu Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Orca Security Scan Summary

Status Check Issues by priority
Passed Passed Infrastructure as Code high 0   medium 0   low 0   info 0 View in Orca
Passed Passed SAST high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Vulnerabilities high 0   medium 0   low 0   info 0 View in Orca

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a client-side KeyError: 'pq' raised when updating RQ quantizer settings on an HFresh vector index by making the quantizer-switch guard tolerant of schemas that don’t include pq (HFresh schemas may only contain an rq block). This aligns client behavior with server behavior and documented runtime mutability of rq.rescoreLimit.

Changes:

  • Avoid direct subscripting of vector_index_config["pq"] in the quantizer-switch guard; use a safe default when pq is missing.
  • Add regression tests covering updating RQ on HFresh schemas without pq/bq/sq blocks.
  • Add a test ensuring quantizer switching remains rejected on HNSW when PQ is enabled.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
weaviate/collections/classes/config.py Makes quantizer-switch guard robust to missing pq block in vector index config (prevents KeyError).
test/collection/test_config_update.py Adds regression tests for HFresh RQ updates without a pq block and keeps HNSW quantizer-switch rejection covered.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.54%. Comparing base (95b5d76) to head (5c8f7a5).
⚠️ Report is 79 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2147      +/-   ##
==========================================
+ Coverage   86.64%   88.54%   +1.89%     
==========================================
  Files         300      304       +4     
  Lines       23172    23486     +314     
==========================================
+ Hits        20077    20795     +718     
+ Misses       3095     2691     -404     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Shah91n
Shah91n merged commit 9f59a36 into main Aug 24, 2026
128 checks passed
@Shah91n
Shah91n deleted the fix/hfresh-quantizer-update-keyerror branch August 24, 2026 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants