MemPalace/mempalace · error · ValueError

remote artifact is missing required field {key!r}

Error message

remote artifact is missing required field {key!r}

What it means

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

Source

Thrown at mempalace/logstream.py:935

        return True

    def has_artifact(self, artifact_id: str) -> bool:
        """Cheap existence probe (no content transfer) for the sync engine."""
        artifact_id = _sanitize_routing(artifact_id, "artifact_id")
        with self._lock:
            conn = self._conn()
            row = conn.execute("SELECT 1 FROM artifacts WHERE id = ?", (artifact_id,)).fetchone()
        return row is not None

    def apply_remote_artifact(self, artifact: dict) -> bool:
        """Fold one remote artifact in, idempotently, verifying its hash.

        Content is verbatim; the sha256 must match or the artifact is
        rejected — a corrupt transfer must never enter the store.
        """
        for key in ("id", "kind", "sha256", "content", "created_by", "created_at"):
            if not artifact.get(key):
                raise ValueError(f"remote artifact is missing required field {key!r}")
        content = artifact["content"]
        digest = sha256(content.encode("utf-8")).hexdigest()
        if digest != artifact["sha256"]:
            raise ValueError(
                f"remote artifact {artifact['id']!r} failed hash verification "
                f"(claimed {artifact['sha256'][:16]}..., computed {digest[:16]}...)"
            )
        metadata_json = _sanitize_metadata(artifact.get("metadata"))
        with self._lock:
            conn = self._conn()
            with conn:
                dup = conn.execute(
                    "SELECT 1 FROM artifacts WHERE id = ?", (artifact["id"],)
                ).fetchone()
                if dup:
                    return False
                conn.execute(
                    "INSERT INTO artifacts (id, kind, sha256, size_bytes, content,"

View on GitHub (pinned to 06cb6987f0)

Solutions

  1. Reject the artifact and re-fetch it from the peer; verify peer version compatibility

When it happens

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

Common situations: Peer sent an artifact record missing a required field.


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