MemPalace/mempalace · error · ValueError

remote event is missing required field {key!r}

Error message

remote event is missing required field {key!r}

What it means

Error "remote event is missing required field {key!r}" thrown in MemPalace/mempalace.

Source

Thrown at mempalace/logstream.py:861

        the arrival cursor — is ours. Referenced artifacts must already be
        applied (sync pulls artifacts first) so readers never see a dangling
        id, same invariant as append_event. Returns True if inserted, False
        if we already had it. Raises ValueError on malformed input or a
        missing artifact.
        """
        for key in (
            "id",
            "type",
            "stream",
            "room",
            "from_agent",
            "created_at",
            "origin_replica",
            "origin_seq",
            "hlc",
        ):
            if not event.get(key):
                raise ValueError(f"remote event is missing required field {key!r}")
        if event["origin_replica"] == self.replica_id:
            return False  # our own op echoed back — by definition already present
        artifact_ids = list(dict.fromkeys(event.get("artifact_ids") or []))
        metadata_json = _sanitize_metadata(event.get("metadata"))

        with self._lock:
            conn = self._conn()
            with conn:
                dup = conn.execute(
                    "SELECT 1 FROM events WHERE id = ? OR (origin_replica = ? AND origin_seq = ?)",
                    (event["id"], event["origin_replica"], event["origin_seq"]),
                ).fetchone()
                if dup:
                    return False
                for artifact_id in artifact_ids:
                    found = conn.execute(
                        "SELECT 1 FROM artifacts WHERE id = ?", (artifact_id,)
                    ).fetchone()

View on GitHub (pinned to 06cb6987f0)

Solutions

  1. Reject or re-fetch the malformed event; ensure the peer runs a compatible mempalace version

When it happens

Trigger: Thrown at mempalace/logstream.py:861 when the library encounters an invalid state.

Common situations: A sync peer sent an event missing a required field (schema mismatch or truncated payload).


AI-assisted analysis of MemPalace/mempalace@06cb6987f0 (2026-08-15). Data as JSON: /api/errors/443b29d36d91898c. Report an issue: GitHub.