{"record":{"id":"896d058d901dcc39","repo":"RyanCodrai/turbovec","slug":"persisted-dimensions-state-get-dimensions-doe","errorCode":null,"errorMessage":"persisted dimensions={state.get('dimensions')} does not match this store's embedder dimensions={self.dimensions}","messagePattern":"persisted dimensions=(.+?) does not match this store's embedder dimensions=(.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"turbovec-python/python/turbovec/agno.py","lineNumber":1221,"sourceCode":"            )\n\n    def _load_from(self, folder: Path) -> None:\n        side_car = folder / _STORE_FILENAME\n        index_file = folder / _INDEX_FILENAME\n        if not side_car.exists() or not index_file.exists():\n            raise FileNotFoundError(\n                f\"missing one of {_STORE_FILENAME}/{_INDEX_FILENAME} under {folder}\"\n            )\n        with open(side_car) as f:\n            state = json.load(f)\n        version = state.get(\"schema_version\", 0)\n        check_schema_version(\n            version,\n            _DOCSTORE_SCHEMA_COMPAT,\n            prefix=f\"{_STORE_FILENAME} has schema_version\",\n        )\n        if state.get(\"dimensions\") != self.dimensions:\n            raise ValueError(\n                f\"persisted dimensions={state.get('dimensions')} does not \"\n                f\"match this store's embedder dimensions={self.dimensions}\"\n            )\n        # Similarity mode of the persisted vectors. The construct-then-\n        # create() API shape means the store already has a mode when the\n        # load runs, so a *recorded* mode that conflicts with it is an\n        # error — silently adopting either side would surprise someone.\n        # A v1 side-car (written before the mode existed) records no\n        # mode but holds raw, unnormalized vectors: adopt\n        # Distance.max_inner_product — the scoring those stores were\n        # written under — and update `self.distance` so introspection\n        # reflects how the store actually scores.\n        recorded = state.get(\"distance\")\n        if recorded is not None:\n            if recorded != self.distance.value:\n                raise ValueError(\n                    f\"persisted store at {folder} was saved with \"\n                    f\"distance={recorded!r}, but this store was constructed \"","sourceCodeStart":1203,"sourceCodeEnd":1239,"githubUrl":"https://github.com/RyanCodrai/turbovec/blob/ccab9f325e6ce2a270a87daf01ae4e443bcf2d49/turbovec-python/python/turbovec/agno.py#L1203-L1239","documentation":"Raised in TurboQuantVectorDb._load_from when the persisted side-car's `dimensions` field differs from self.dimensions (the dimension implied by the embedder passed to this store instance). The saved index was built with a different embedder size, so its vectors cannot be searched with this instance's configuration.","triggerScenarios":"Thrown at turbovec-python/python/turbovec/agno.py:1221 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Construct the store with the embedder whose dimension matches the persisted state (compare state['dimensions'] with the embedder's output size).","Rebuild the store from source documents if the embedder has intentionally changed.","Catch the ValueError to surface a clear 'wrong embedder for this saved store' configuration error to users."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"ccab9f325e6ce2a270a87daf01ae4e443bcf2d49","analyzedAt":"2026-09-06T08:39:18.516Z","contentChangedAt":"2026-09-06T08:39:18.516Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}