{"record":{"id":"2ad26becece3777c","repo":"MemPalace/mempalace","slug":"remote-artifact-is-missing-required-field-key-r","errorCode":null,"errorMessage":"remote artifact is missing required field {key!r}","messagePattern":"remote artifact is missing required field (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"mempalace/logstream.py","lineNumber":935,"sourceCode":"        return True\n\n    def has_artifact(self, artifact_id: str) -> bool:\n        \"\"\"Cheap existence probe (no content transfer) for the sync engine.\"\"\"\n        artifact_id = _sanitize_routing(artifact_id, \"artifact_id\")\n        with self._lock:\n            conn = self._conn()\n            row = conn.execute(\"SELECT 1 FROM artifacts WHERE id = ?\", (artifact_id,)).fetchone()\n        return row is not None\n\n    def apply_remote_artifact(self, artifact: dict) -> bool:\n        \"\"\"Fold one remote artifact in, idempotently, verifying its hash.\n\n        Content is verbatim; the sha256 must match or the artifact is\n        rejected — a corrupt transfer must never enter the store.\n        \"\"\"\n        for key in (\"id\", \"kind\", \"sha256\", \"content\", \"created_by\", \"created_at\"):\n            if not artifact.get(key):\n                raise ValueError(f\"remote artifact is missing required field {key!r}\")\n        content = artifact[\"content\"]\n        digest = sha256(content.encode(\"utf-8\")).hexdigest()\n        if digest != artifact[\"sha256\"]:\n            raise ValueError(\n                f\"remote artifact {artifact['id']!r} failed hash verification \"\n                f\"(claimed {artifact['sha256'][:16]}..., computed {digest[:16]}...)\"\n            )\n        metadata_json = _sanitize_metadata(artifact.get(\"metadata\"))\n        with self._lock:\n            conn = self._conn()\n            with conn:\n                dup = conn.execute(\n                    \"SELECT 1 FROM artifacts WHERE id = ?\", (artifact[\"id\"],)\n                ).fetchone()\n                if dup:\n                    return False\n                conn.execute(\n                    \"INSERT INTO artifacts (id, kind, sha256, size_bytes, content,\"","sourceCodeStart":917,"sourceCodeEnd":953,"githubUrl":"https://github.com/MemPalace/mempalace/blob/06cb6987f02610784fefbad4b2bd5d026d164ba6/mempalace/logstream.py#L917-L953","documentation":"Error \"remote artifact is missing required field {key!r}\" thrown in MemPalace/mempalace.","triggerScenarios":"Thrown at mempalace/logstream.py:935 when the library encounters an invalid state.","commonSituations":"Peer sent an artifact record missing a required field.","solutions":["Reject the artifact and re-fetch it from the peer; verify peer version compatibility"],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"06cb6987f02610784fefbad4b2bd5d026d164ba6","analyzedAt":"2026-08-15T03:03:36.213Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}