MemPalace/mempalace · error · UnsupportedFilterError
operator {key!r} not supported by chroma backend
Error message
operator {key!r} not supported by chroma backend What it means
A ValueError from replica identity loading: the replica file parsed, but replica_id is not a string matching the expected id pattern. Same rationale as the corrupt-file case — minting a second id for one palace would fork op-log provenance, so the invalid file must be restored or deleted explicitly.
Source
Thrown at mempalace/backends/chroma.py:384
raise UnsupportedFilterError(f"operator {op!r} not supported by chroma backend")
def _matches_where(meta: dict, where: Optional[dict]) -> bool:
if not where:
return True
if not isinstance(where, dict):
return False
for key, expected in where.items():
if key == "$and":
if not all(_matches_where(meta, clause) for clause in expected or []):
return False
continue
if key == "$or":
if not any(_matches_where(meta, clause) for clause in expected or []):
return False
continue
if key.startswith("$"):
raise UnsupportedFilterError(f"operator {key!r} not supported by chroma backend")
actual = meta.get(key)
if isinstance(expected, dict):
for op, operand in expected.items():
if not _compare_metadata(actual, op, operand):
return False
elif actual != expected:
return False
return True
def _metadata_cell_value(sval, ival, fval, bval):
if sval is not None:
return sval
if ival is not None:
return ival
if fval is not None:
return fval
if bval is not None:View on GitHub (pinned to 06cb6987f0)
Solutions
- Restore the correct original replica_id string from a palace backup.
- If the original id is lost and you accept forking provenance, delete the file and let it re-mint a valid id.
- If scripting writes to this file, validate the value against the id pattern before writing.
Defensive patterns
Strategy: type-guard
Validate before calling
import json, re
from pathlib import Path
data = json.loads((Path(palace_path)/'replica.json').read_text())
rid = data.get('replica_id')
assert isinstance(rid, str) and re.match(r'^rep_[0-9a-f]+$', rid), f'bad replica_id: {rid!r}' Type guard
def has_valid_replica_id(palace_path: str) -> bool:
try:
data = json.loads((Path(palace_path)/'replica.json').read_text(encoding='utf-8'))
except Exception:
return False
return isinstance(data.get('replica_id'), str) Try / catch
try:
rid = load_or_mint_replica_id(palace_path)
except ValueError as e:
if 'invalid replica_id' in str(e):
restore_original_id_from_backup() # or intentionally delete to re-mint Prevention
- Copy replica_id values verbatim (string, original format) when scripting palace copies.
- Validate the id pattern before writing the file in any tooling.
When it happens
Trigger: load_or_mint_replica_id() reads data['replica_id'] that is a non-string (int, null, list) or a string failing the _REPLICA_ID_RE format check.
Common situations: Hand-editing replica.json and storing the wrong type; a migration script writing an unquoted id; template placeholders like "REPLICA_ID" left in the file.
Related errors
- operator {op!r} not supported by chroma backend
- --metadata is not valid JSON: {exc}
- --metadata must be a JSON object
- invalid repair backup record at line {line_number}
- metadata is not JSON-serializable: {exc}
AI-assisted analysis of MemPalace/mempalace@06cb6987f0 (2026-08-15).
Data as JSON: /api/errors/a2ac9b3a1eae4099.
Report an issue: GitHub.