MemPalace/mempalace · error · ValueError

remote event {event['id']!r} references artifact {artifact_i

Error message

remote event {event['id']!r} references artifact {artifact_id!r} not yet applied locally

What it means

Error "remote event {event['id']!r} references artifact {artifact_id!r} not yet applied locally" thrown in MemPalace/mempalace.

Source

Thrown at mempalace/logstream.py:881

            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()
                    if not found:
                        raise ValueError(
                            f"remote event {event['id']!r} references artifact "
                            f"{artifact_id!r} not yet applied locally"
                        )
                conn.execute(
                    "INSERT INTO events (id, type, stream, room, from_agent, to_agent,"
                    " correlation_id, branch, base_commit, status, body, created_at,"
                    " metadata_json, origin_replica, origin_seq, hlc)"
                    " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
                    (
                        event["id"],
                        event["type"],
                        event["stream"],
                        event["room"],
                        event["from_agent"],
                        event.get("to_agent"),
                        event.get("correlation_id"),
                        event.get("branch"),
                        event.get("base_commit"),

View on GitHub (pinned to 06cb6987f0)

Solutions

  1. Re-sync so the referenced artifact is applied before the event that references it

When it happens

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

Common situations: Events were applied out of order, or the artifact transfer failed earlier.


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