{"record":{"id":"fc608496f1484fa8","repo":"chroma-core/chroma","slug":"expected-sparsevector-labels-to-be-a-list-got-ty","errorCode":null,"errorMessage":"Expected SparseVector labels to be a list, got {type(self.labels).__name__}","messagePattern":"Expected SparseVector labels to be a list, got (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"chromadb/base_types.py","lineNumber":52,"sourceCode":"        if not isinstance(self.indices, list):\n            raise ValueError(\n                f\"Expected SparseVector indices to be a list, got {type(self.indices).__name__}\"\n            )\n\n        if not isinstance(self.values, list):\n            raise ValueError(\n                f\"Expected SparseVector values to be a list, got {type(self.values).__name__}\"\n            )\n\n        if len(self.indices) != len(self.values):\n            raise ValueError(\n                f\"SparseVector indices and values must have the same length, \"\n                f\"got {len(self.indices)} indices and {len(self.values)} values\"\n            )\n\n        if self.labels is not None:\n            if not isinstance(self.labels, list):\n                raise ValueError(\n                    f\"Expected SparseVector labels to be a list, got {type(self.labels).__name__}\"\n                )\n            if len(self.labels) != len(self.indices):\n                raise ValueError(\n                    f\"SparseVector labels must have the same length as indices and values, \"\n                    f\"got {len(self.labels)} labels, {len(self.indices)} indices\"\n                )\n\n        for i, idx in enumerate(self.indices):\n            if not isinstance(idx, int):\n                raise ValueError(\n                    f\"SparseVector indices must be integers, got {type(idx).__name__} at position {i}\"\n                )\n            if idx < 0:\n                raise ValueError(\n                    f\"SparseVector indices must be non-negative, got {idx} at position {i}\"\n                )\n","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/chroma-core/chroma/blob/aecdd12c8a891610db8653630b066b32ceb678b5/chromadb/base_types.py#L34-L70","documentation":"Raised by SparseVector.__post_init__ when the labels attribute is not a Python list (e.g. a numpy array, tuple, or scalar was passed). Part of the constructor's self-validation that ensures labels, indices, and values are plain lists of matching length.","triggerScenarios":"Thrown at chromadb/base_types.py:52 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Convert labels with list(labels) before constructing SparseVector","Pass labels as a plain Python list of strings, or omit it entirely (default None)"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"aecdd12c8a891610db8653630b066b32ceb678b5","analyzedAt":"2026-08-16T21:53:27.228Z","contentChangedAt":"2026-08-16T21:53:27.228Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}