{"record":{"id":"3916c272d736fc75","repo":"chroma-core/chroma","slug":"unknown-distance-function-space","errorCode":null,"errorMessage":"Unknown distance function: {space}","messagePattern":"Unknown distance function: (.+?)","errorType":"validation","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"chromadb/segment/impl/vector/brute_force_index.py","lineNumber":40,"sourceCode":"    id_to_index: Dict[str, int]\n    index_to_id: Dict[int, str]\n    id_to_seq_id: Dict[str, int]\n    deleted_ids: Set[str]\n    free_indices: List[int]\n    size: int\n    dimensionality: int\n    distance_fn: Callable[[npt.NDArray[Any], npt.NDArray[Any]], float]\n    vectors: npt.NDArray[Any]\n\n    def __init__(self, size: int, dimensionality: int, space: str = \"l2\"):\n        if space == \"l2\":\n            self.distance_fn = distance_functions.l2\n        elif space == \"ip\":\n            self.distance_fn = distance_functions.ip\n        elif space == \"cosine\":\n            self.distance_fn = distance_functions.cosine\n        else:\n            raise Exception(f\"Unknown distance function: {space}\")\n\n        self.id_to_index = {}\n        self.index_to_id = {}\n        self.id_to_seq_id = {}\n        self.deleted_ids = set()\n        self.free_indices = list(range(size))\n        self.size = size\n        self.dimensionality = dimensionality\n        self.vectors = np.zeros((size, dimensionality))\n\n    def __len__(self) -> int:\n        return len(self.id_to_index)\n\n    def clear(self) -> None:\n        self.id_to_index = {}\n        self.index_to_id = {}\n        self.id_to_seq_id = {}\n        self.deleted_ids.clear()","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/chroma-core/chroma/blob/aecdd12c8a891610db8653630b066b32ceb678b5/chromadb/segment/impl/vector/brute_force_index.py#L22-L58","documentation":"Error \"Unknown distance function: {space}\" thrown in chroma-core/chroma.","triggerScenarios":"Thrown at chromadb/segment/impl/vector/brute_force_index.py:40 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"aecdd12c8a891610db8653630b066b32ceb678b5","analyzedAt":"2026-08-16T21:53:27.228Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}