{"record":{"id":"3ca4dcfc1435e175","repo":"cocoindex-io/cocoindex","slug":"unsupported-quantize-type-quantize-r","errorCode":null,"errorMessage":"Unsupported quantize type: {quantize!r}","messagePattern":"Unsupported quantize type: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/cocoindex/connectors/zvec/_target.py","lineNumber":535,"sourceCode":"        return _zvec.MetricType.COSINE\n    if key == \"ip\":\n        return _zvec.MetricType.IP\n    if key == \"l2\":\n        return _zvec.MetricType.L2\n    raise ValueError(f\"Unsupported metric type: {metric!r}\")\n\n\ndef _quantize_type(quantize: str) -> Any | None:\n    key = quantize.lower()\n    if key == \"none\":\n        return None\n    if key == \"fp16\":\n        return _zvec.QuantizeType.FP16\n    if key == \"int8\":\n        return _zvec.QuantizeType.INT8\n    if key == \"int4\":\n        return _zvec.QuantizeType.INT4\n    raise ValueError(f\"Unsupported quantize type: {quantize!r}\")\n\n\ndef _build_zvec_schema(collection_name: str, schema: CollectionSchema[Any]) -> Any:\n    fields: list[Any] = []\n    vectors: list[Any] = []\n    for name, col in schema.columns.items():\n        if name == schema.primary_key:\n            continue  # primary key maps to the document id, not a field\n        if col.kind == \"scalar\":\n            index_param = _zvec.InvertIndexParam() if col.indexed else None\n            fields.append(\n                _zvec.FieldSchema(\n                    name=name,\n                    data_type=col.data_type,\n                    nullable=col.nullable,\n                    index_param=index_param,\n                )\n            )","sourceCodeStart":517,"sourceCodeEnd":553,"githubUrl":"https://github.com/cocoindex-io/cocoindex/blob/e84aa99b3292c5270a4b313b2a7137ad9ce8ab3b/python/cocoindex/connectors/zvec/_target.py#L517-L553","documentation":"Mapper guard in _quantize_type during zvec schema building. Recognized quantize modes are 'none' (no quantization, returns None), 'fp16', 'int8', and 'int4' (case-insensitive); anything else has no zvec QuantizeType counterpart and is rejected here rather than surfacing as an engine-internal failure. Caused by a misspelled or unsupported quantize setting; use none, fp16, int8, or int4.","triggerScenarios":"Setting quantize on a vector column to an unsupported value, e.g. 'scalar', 'product', 'pq', or mis-cased like 'FP16' beyond the recognized keys.","commonSituations":"Copying quantization settings from FAISS/GPU index configs; typo like 'int8 ' with whitespace; expecting binary quantization which zvec does not expose here.","solutions":["Use one of: 'none', 'fp16', 'int8', 'int4'.","Remove the quantize setting entirely to use the default (no quantization).","Normalize/validate the quantize string before declaring the collection."],"exampleFix":"// before\nColumn(kind=\"dense\", dim=768, quantize=\"product\")\n// after\nColumn(kind=\"dense\", dim=768, quantize=\"int8\")","handlingStrategy":"validation","validationCode":"ALLOWED = {\"none\", \"fp16\", \"int8\", \"int4\"}\nassert quantize.lower() in ALLOWED, f\"quantize must be one of {ALLOWED}\"","typeGuard":null,"tryCatchPattern":"try:\n    target = collection_target(...)\nexcept ValueError as e:\n    if \"quantize\" in str(e): ...","preventionTips":["Only use 'none', 'fp16', 'int8', or 'int4'.","Omit quantize entirely when no quantization is desired.","Strip whitespace and lowercase config strings before use."],"tags":["python","vector-database","invalid-enum","quantization"],"backgroundTag":"unsupported-enum-value","analyzedSha":"e84aa99b3292c5270a4b313b2a7137ad9ce8ab3b","analyzedAt":"2026-09-08T15:59:19.997Z","contentChangedAt":"2026-09-08T15:59:19.997Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}