MemPalace/mempalace · error · ValueError
{path} holds an invalid replica_id {replica_id!r}; refusing
Error message
{path} holds an invalid replica_id {replica_id!r}; refusing to mint a second identity — restore or delete the file explicitly What it means
Error "{path} holds an invalid replica_id {replica_id!r}; refusing to mint a second identity — restore or delete the file explicitly" thrown in MemPalace/mempalace.
Source
Thrown at mempalace/replica.py:50
"""Return this palace's stable replica id, minting it on first use.
The file is written atomically (tmp + rename) so a crash mid-mint can
never leave a half-written identity; a corrupt or foreign-shaped file
fails loudly rather than silently minting a second identity — two ids
for one replica would fork its op-log provenance.
"""
path = Path(os.path.expanduser(palace_path)) / REPLICA_FILENAME
if path.exists():
try:
data = json.loads(path.read_text(encoding="utf-8"))
replica_id = data["replica_id"]
except (ValueError, KeyError, TypeError) as exc:
raise ValueError(
f"{path} is corrupt ({exc}); refusing to mint a second replica "
"identity for this palace — restore or delete the file explicitly"
) from None
if not isinstance(replica_id, str) or not _REPLICA_ID_RE.match(replica_id):
raise ValueError(
f"{path} holds an invalid replica_id {replica_id!r}; refusing to "
"mint a second identity — restore or delete the file explicitly"
)
return replica_id
path.parent.mkdir(parents=True, exist_ok=True)
replica_id = _mint()
tmp = path.with_suffix(".json.tmp")
tmp.write_text(
json.dumps({"replica_id": replica_id, "minted_at_note": "RFC 004 step 0"}, indent=2) + "\n",
encoding="utf-8",
)
os.replace(tmp, path)
return replica_id
View on GitHub (pinned to 06cb6987f0)
Solutions
- Restore a valid replica_id or delete the file explicitly to mint a new identity
When it happens
Trigger: Thrown at mempalace/replica.py:50 when the library encounters an invalid state.
Common situations: Replica identity file contained an invalid id.
AI-assisted analysis of MemPalace/mempalace@06cb6987f0 (2026-08-15).
Data as JSON: /api/errors/82da3a3da5681963.
Report an issue: GitHub.