{"record":{"id":"fed4be83e467724b","repo":"mem0ai/mem0","slug":"unsupported-distance-metric-metric","errorCode":null,"errorMessage":"Unsupported distance metric: {metric}","messagePattern":"Unsupported distance metric: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"mem0/vector_stores/oracledb.py","lineNumber":61,"sourceCode":"            \"and array wildcards '[*]' are allowed.\"\n        )\n\n\n_SCORE_FROM_DISTANCE = {\n    \"COSINE\": lambda d: max(0.0, min(1.0, 1.0 - d)),\n    \"EUCLIDEAN\": lambda d: 1.0 / (1.0 + max(0.0, d)),\n    \"EUCLIDEAN_SQUARED\": lambda d: 1.0 / (1.0 + math.sqrt(max(0.0, d))),\n    \"HAMMING\": lambda d: 1.0 / (1.0 + max(0.0, d)),\n    \"MANHATTAN\": lambda d: 1.0 / (1.0 + max(0.0, d)),\n    \"DOT\": lambda d: -d,\n}\n\n\ndef _convert_distance_to_score(distance: float, metric: str) -> float:\n    try:\n        return _SCORE_FROM_DISTANCE[metric.upper()](distance)\n    except KeyError:\n        raise ValueError(f\"Unsupported distance metric: {metric}\") from None\n\n\n_FIELD_OPERATORS = {\"eq\", \"ne\", \"gt\", \"gte\", \"lt\", \"lte\", \"in\", \"nin\", \"contains\", \"icontains\"}\n_COMPARISON_OPERATORS = {\n    \"eq\": \"==\",\n    \"ne\": \"!=\",\n    \"gt\": \">\",\n    \"gte\": \">=\",\n    \"lt\": \"<\",\n    \"lte\": \"<=\",\n}\n_LOGICAL_OPERATORS = {\n    \"$and\": \"and\",\n    \"$or\": \"or\",\n    \"$not\": \"not\",\n    \"AND\": \"and\",\n    \"OR\": \"or\",\n    \"NOT\": \"not\",","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/mem0ai/mem0/blob/001c235229be8795e3834520467bd0d661ed8f34/mem0/vector_stores/oracledb.py#L43-L79","documentation":"Error \"Unsupported distance metric: {metric}\" thrown in mem0ai/mem0.","triggerScenarios":"Thrown at mem0/vector_stores/oracledb.py:61 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a supported distance metric (e.g. COSINE, EUCLIDEAN_DISTANCE, DOT_PRODUCT)."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"001c235229be8795e3834520467bd0d661ed8f34","analyzedAt":"2026-08-15T01:55:42.685Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}